Simotion Example for Beginners d435 En
Short Description
Download Simotion Example for Beginners d435 En...
Description
SIMOTION
SIMOTION Example for Beginners
© SIEMENS AG 2009
Automation and Drives
Example for Beginners Disclaimer of liability SIMOTION
Task SIMOTION - Basic Information Program Design Program Implementation
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 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/2
Automation and Drives
Example for Beginners Some preliminary comments SIMOTION
Task SIMOTION - Basic Information Program Design Program Implementation
© SIEMENS AG 2009
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 possible (e.g. a virtual axis as master). In some cases, the notes page provides further information for the associated slide. The screenshots were created with SIMOTION Version 4.1 (05/2009). Under some circumstances there may be minor changes for future versions. The firmware version on the D435 should agree with the SIMOTION SCOUT version
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/3
Automation and Drives
Example for Beginners Machine diagrams SIMOTION
Task SIMOTION - Basic Information Product feed
Program Design Program Implementation
Package (empty)
Extractor - electric travel - eject pneumatically
Package (full)
Palletizer Carton erector
Conveyor belt
Sensor
Procedure notes are contained in the Program Design section © SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/4
Automation and Drives
Example for Beginners
Topology of the automation solution SIMOTION
SIMOTION SCOUT
Task SIMOTION - Basic Information
HMI MP270
Program Design
D435
PROFIBUS DP
Carton erector* Feed*
Program Implementation
Transport
ET 200 * MICROMASTER 420 *
Extractor 1 FK7
* Not considered in the example, but part of the complete plant © SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/5
Automation and Drives
Example for Beginners Execution system SIMOTION
Task
Stop
Run
Start-up Task
SIMOTION - Basic Information Program Design Program Implementation
Run Call Motion Tasks (sequential tasks)
Background Task
Background Task
Motion Tasks
Motion Task 1
Synchronous Tasks
IPO - sync Task 1
Time-triggered Tasks
Task 1
Task 2
Task 5
Interrupt Tasks
User Int Task 1
User Int Task 2
System Int Tasks System Int Tasks System Int Tasks
Run
1 Motion Task 2
IPO - sync Task 2
Motion Task 20
2
Monitor the emergency off criteria
Response to process signals
3
Stop
Shut-down Task
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/6
Automation and Drives
Example for Beginners
Comparison of cyclical and sequential programming SIMOTION
Task
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.
SIMOTION - Basic Information
Sequential task:
Program Design Program Implementation
_pos ( axis:=Pos, position := Ziel, nextCommand:=WHEN_MOTION_DONE) Advance command Program processing stops until the target position is reached Finished:= TRUE;
Cyclical task: Query status pos. command
Pos_status := _getStateOfAxisCommand (Pos, PosCommandID)
IF (Pos_status ACTIVE AND Pos. command Fertig = FALSE ) THEN Advance _pos (axis:=Pos, command position:= Target, nextCommand:=IMMEDIATELY, commandID:= PosCommandID); END_IF IF Pos.motionstatedata.motioncommand = MOTION_DONE THEN Query position Fertig:= TRUE; END_IF Cyclical program section continued
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/7
Automation and Drives
Example for Beginners Variable model SIMOTION
Task SIMOTION - Basic Information Program Design Program Implementation
System variables Technology objects SIMOTION device
Global user variables I/O variables Device global 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 Variable can be accessed from programs, FCs and FBs in a unit
Unit variables
Local user variables
Variable can only be used within the declaring program
Program variables Variable can only be used within the declaring function (FC)
FC variables
Variable can only be used in the declaring function block (FB)
FB variables
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/8
Automation and Drives
Example for Beginners Solution guide SIMOTION
Task SIMOTION - Basic Information Program Design Program Implementation
Current situation
Problem task (machine diagram)
Topology concept with SIMOTION
Program concept
Technology objects
Task structure
Task relationships
Variables
Master axis
Conveyor belt
Extractor
Output cam configuration Cam configuration
611U parameterization System environment Create device Specification of the possible DP cycle clock
Issued: 05/2009
Specification of the possible DP cycle clock Axis configuration
Drives
© SIEMENS AG 2009
Creation of a hardware configuration
Siemens I IA DT MC
Form
Parameterization
Programming, parameterization and test ProTool connection
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/9
Automation and Drives
Example for Beginners Technology objects SIMOTION
Task SIMOTION - Basic Information Program Design Program Implementation
Virtual master axis
Positioning axis
Rotary axis (modulo)
Real axis - conveyor belt
Following axis
Rotary axis (modulo)
Gearbox synchronism
Cam controller - pneumatic extractor
Position-based cams
Interpolator
Real axis - pusher
Following axis
Linear axis
Camming
Cam - extractor
© SIEMENS AG 2009
Not cyclical
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/10
Automation and Drives
Example for Beginners Task structure SIMOTION
Task SIMOTION - Basic Information Program Design Program Implementation
Startup Task
ST initialization
Background Task
Execution control – FBD
Call the homing task / initial setting travel – FBD
Call the automatic operation – FBD
Motion Task 2 (Hominging)
User Interrupt 1 (stock outage detection) Call the extractor task – MCC IPO synchronous task (emergency stop monitoring) Test protective door – MCC Tech Fault / Peripheral Fault - Task (error handling) Acknowledge error – MCC
Homing and possibly initial setting travel of the associated axes - MCC
Motion Task 3 (Automatic operation)
Start the master axis – MCC
Synchronize the conveyor belt – MCC
Trigger the pneumatic valve – MCC
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/11
Automation and Drives
Example for Beginners Task relationships SIMOTION
Motion Task 2 Task
Start-up
SIMOTION - Basic Information Program Design Program Implementation
Motion Task 3 Background
Start program pEject
User Interrupt
Interrupts the task IPO Sync Task
© SIEMENS AG 2009
Issued: 05/2009
Motion Task 2 Motion Task 3
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/12
Automation and Drives
Example for Beginners Variables SIMOTION
Task SIMOTION - Basic Information
Device-global variables
None
I/O Variables (symbol browser)
Unit-global variables
Velocity of the leading axis
Program Design
Open protective door
Program end
Program Implementation
Operating mode
Locale variables
None
Onboard inputs:
dig_inputs (alle Eingänge) WORD (PIW298)
i_boEject (Sensor) Bool PI299.2
i_boProtDoor Bool PI299.0
i_boStartBelt Bool PI299.1
Fast outputs (output cam object)
Onboard outputs:
Ausschieber aktiv Nocken PQ298.0
Naming variables Variables are named in accordance with the instructions from the SIMOTION ST V4.0
programming standards
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/13
Automation and Drives
Example for Beginners
HW configuration – create device SIMOTION
Task SIMOTION - Basic Information
New Scout – create project Create new device (D435 V4.1) Select the interface for PG (retain the default setting) Æ The networking for PG in NetPro will be created automatically
Program Design Program Implementation
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/14
Automation and Drives
Example for Beginners HW configuration SIMOTION
Select cycle for internal interface e.g. 2ms Æ increase factor to 8
Task SIMOTION - Basic Information Program Design Program Implementation
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/15
Automation and Drives
Example for Beginners Net Pro SIMOTION
The network configuration for PG is created automatically Task SIMOTION - Basic Information Program Design Program Implementation
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/16
Automation and Drives
Example for Beginners Configure drive 1 SIMOTION
Task SIMOTION - Basic Information
Configure drive device Use unregulated infeed for SIMOTION D - demonstration kit
Program Design Program Implementation
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/17
Automation and Drives
Example for Beginners Configure drive 1 SIMOTION
Select power section (dual-axis module) Select rating according to the rating plate
Task SIMOTION - Basic Information Program Design Program Implementation
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/18
Automation and Drives
Example for Beginners Configure drive 1 SIMOTION
Task
Motor with DRIVE-CLiQÆ no further details for the motor type required
SIMOTION - Basic Information Program Design Program Implementation
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/19
Automation and Drives
Example for Beginners Configure drive 1 SIMOTION
Task SIMOTION - Basic Information
Telegram type 105
Program Design Program Implementation
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/20
Automation and Drives
Example for Beginners Configure drive 2 SIMOTION
Task SIMOTION - Basic Information Program Design
Motor with SMC motor type and speed in accordance with rating plate
Program Implementation
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/21
Automation and Drives
Example for Beginners Configure drive 2 SIMOTION
Task
Select encoder in accordance with rating plate, e.g. Endat
SIMOTION - Basic Information Program Design Program Implementation
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/22
Automation and Drives
Example for Beginners
Comparison with hardware configuration SIMOTION
Task
SINAMICS configuration Comparison with the hardware configuration Æ Entry of the I/O addresses by SIMOTION SCOUT
SIMOTION - Basic Information Program Design Program Implementation
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/23
Automation and Drives
Example for Beginners
Telegram extension for control unit in HW-Config Open
SIMOTION
hardware configuration Sinamics-integrated
object properties
Task SIMOTION - Basic Information
Activate
Program Design
Select
standard telegram 1
Program Implementation
Save
and
compile
No further comparison with hardware configuration!!! © SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/24
Automation and Drives
Example for Beginners Telegram for control unit SIMOTION
Wiring of the digital inputs to the send telegram of the control unit Æ Inputs available for Simotion
Task SIMOTION - Basic Information Program Design Program Implementation
Mouse click on interconnection icon: Æ Control unit other interconnections r722 © SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/25
Automation and Drives
Example for Beginners
Wiring of an input for the infeed (e.g. input 7) SIMOTION
The wiring must be made for both drives Task SIMOTION - Basic Information Program Design Program Implementation
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/26
Automation and Drives
Example for Beginners
Reduce the device connection voltage SIMOTION
Task
For SIMOTION D demo kit: Reduce the parameter 210 from 600 V to 345 V for single phase connection Must be carried out for both drives
SIMOTION - Basic Information Program Design Program Implementation
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/27
Automation and Drives
Example for Beginners System cycle clocks SIMOTION
Task SIMOTION - Basic Information Program Design Program Implementation
© SIEMENS AG 2009
Set system cycle clocks
Right-click on the execution system
Ratio: DP to LR to IPO = 1 : 1 : 1
Clock times: 3 ms : 3 ms : 3 ms
Note: The goal is to always have 1:1:1 as setting. Note: The ratio of IPO2 can be set if necessary
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/28
Automation and Drives
Example for Beginners
Axis configuration – Master axis SIMOTION
Task SIMOTION - Basic Information
Create a virtual “master axis” Positioning axis
Program Design Program Implementation
Rotary axis Modulo Cycle length (product length) 360°
Virtual axis
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/29
Automation and Drives
Example for Beginners
Axis configuration - Conveyor belt SIMOTION
Task SIMOTION - Basic Information
Create a real “Conveyorbelt“ slave axis Following axis
Program Design Program Implementation
Rotary axis Modulo Cycle length (product length) 360° First axis of the dual axis case, nrated = 6000 rpm Message frame type 105 DSC selected Encoder and resolution default values
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/30
Automation and Drives
Example for Beginners Axis configuration - Ejector SIMOTION
Task SIMOTION - Basic Information
Create a real “Ejector“ slave axis Following axis
Program Design Program Implementation
Linear axis Modulo deselected
Second axis of the dual axis case, nrated = 6000 rpm Message frame type 105 DSC selected Encoder and resolution default values
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/31
Automation and Drives
Example for Beginners
Axis configuration - Parameterization SIMOTION
MasterAxis No modifications
Task SIMOTION - Basic Information Program Design Program Implementation
Homing parameterization (here Conveyorbelt)
Conveyorbelt Homing Only zero mark
Control (position-) Speedprecontrol activated Kv=50 ; DSC activated
Ejector
Position control parameterization (here Ejector)
Homing Only zero mark
Control (position-) Speedprecontrol activated Kv=50 ; DSC activated Note: The parameterization in the masks is made offline
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/32
Automation and Drives
Example for Beginners Programming - I/O variables SIMOTION
Task SIMOTION - Basic Information Program Design Program Implementation
Add the I/O variables to the Symbol Browser
“I/O“ symbol in the project tree
Definition of the I/O symbols
i_boProtDoor
Protective door contact
i_boStartBelt
Start conveyor belt
i_boEject
Sensor detects bad part
Note: The input in the Symbol Browser is made offline.
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/33
Automation and Drives
Example for Beginners Access to I/O in cyclical tasks SIMOTION
Task SIMOTION - Basic Information
Access to I/Os of the drives (e.g. onBoard inputs of the CU) only when the drive components have also been ramped up (after Power On) Æ Test in the program for valid accesses of the I/O variables Must be made in all cyclical tasks
Program Design Program Implementation
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/34
Automation and Drives
Example for Beginners
Programming – def_init (variable definition in ST) SIMOTION
Programming
Add ST program (source) “def_init“
Task
Add VAR_GLOBAL and END_VAR keywords
SIMOTION - Basic Information
PROGRAM “init“ keyword
Definition of the variables and default values
Program Design Program Implementation Function
© SIEMENS AG 2009
Definition of unit-global variables in a source
Ensures the simple export of global variables and avoids complicated cross-references (“connections“ or “USES“)
Retain variables and HMI variables should also be declared in their own separate source
Issued: 05/2009
Siemens I IA DT MC
g_boProgEnd
g_boProtDoorOpen
g_rVMasterAxis
g_rVMasterAxisOld
g_iMode
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/35
Automation and Drives
Example for Beginners
Programming – def_init (variable initialization in ST) SIMOTION
Programming
Add PROGRAM “init“ and END_PROGRAM keywords
Initialization of the variables for STOP – RUN transition
Task SIMOTION - Basic Information Program Design Program Implementation
g_boProgEnd
g_boProtDoorOpen
g_rVMasterAxis
g_rVMasterAxisOld
g_iMode
Save and compile
Function
© SIEMENS AG 2009
The “init“ program in the “def_init“ source is used to set the variables to their defined initial value during the startup.
The “init“ ST program must be assigned to the startup task
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/36
Automation and Drives
Example for Beginners
Programming - Techfault Task (MCC) SIMOTION
Task SIMOTION - Basic Information Program Design Program Implementation
Create “tecfault“ MCC Chart.
Used for the error handling.
Generally, an empty program can also be used. In this case, the controller does not STOP, even for errors.
However, all alarms of one object (e.g. Ejector) can also be acknowledged.
It is also possible to acknowledge a specific alarm (e.g. 30002) of an object (here Conveyorbelt).
Note: During commissioning and troubleshooting, it is advisable to directly acknowledge as few alarms as possible. Such alarms often provide useful information about the cause of a malfunction. Warning: When a Techfault task is used, the user assumes the responsibility for the error handling.
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/37
Automation and Drives
Example for Beginners
Programming – Monitoring Motion Tasks SIMOTION
Basic procedure
Program Design
When a program (MCC, ST, LAD/FBD) is created, it is also possible to parameterize whether the program monitors and can operate in single-step mode (MCC).
Program Implementation
The appropriate checkboxes are located in the Compiler tab.
Task SIMOTION - Basic Information
This setting can be made later in the Properties dialog box of the program.
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/38
Automation and Drives
Example for Beginners
Programming – Connection with another source (unit) SIMOTION
Basic procedure Task SIMOTION - Basic Information Program Design Program Implementation
When variables from the “def_init“ source are used in another program, they must be connected to this program. Establish connection with the source (unit) ”def_init“, Connections tab
© SIEMENS AG 2009
MCC: in the Start node (button)
LAD/FBD: program button
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/39
Automation and Drives
Example for Beginners
Programming - Background Task (FUP) SIMOTION
Add “bckFUP“ LAD/FBD plan.
Task
The setup program and the automatic operation are started depending on the contents of the g_iMode variable
SIMOTION - Basic Information
g_iMode = 0 : Setup
Program Design
This occurs only when:
Program Implementation
MotionTask_1 or Motiontask_2 is
g_iMode = 1 : Automatic operation The protective door is closed
Stopped (performed),
Waiting and has been suspended (emergency stop)
Suspended (emergency stop)
Note: If necessary, switch between LAD and FBD
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/40
Automation and Drives
Example for Beginners
Programming – Background Task (FBD) SIMOTION
Task
Network 1: Jump to the end if the drives have not yet been ramped up (no access possible to I/Os from Sinamics)
SIMOTION - Basic Information Program Design Program Implementation
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/41
Automation and Drives
Example for Beginners
Programming - Background Task (FBD) SIMOTION
Create local variables
bTaskState : Status of MotionTask_1 or MotionTask_2
bRetStart : Return value of the “_startTaskID“ function
Program Design
boResult : Result bit of the FBD networks
Program Implementation
bResAnd : Result of the Taskstatus evaluation
boGo: Task start bit (TRUE if MotionTask_1 or MotionTask_2 must be restarted)
sTaskSel : Structure that can contain TaskIDs (e.g. MotionTask_1 or MotionTask_2)
Task SIMOTION - Basic Information
Label in NW9
Network 2: Query protective door contact No new tasks will be started if the protective door is open
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/42
Automation and Drives
Example for Beginners
Programming - Background Task (FBD) SIMOTION
Network 3 and network 4:
Task SIMOTION - Basic Information Program Design Add with empty box
Program Implementation
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
Depending on the g_iMode variable (operating mode, 0: homing, 1: automatic), 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.
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/43
Automation and Drives
Example for Beginners
Programming - Background Task (FBD) Network 5:
SIMOTION
Task SIMOTION - Basic Information Add with empty box
Program Design Program Implementation
The status of a task can be queried in FBD using the “_GetStateOfTaskId“ system function from the “Command Library” tab (built-in compiler functions) and so is always unique and consistent (advantage compared with locking using bits). The function return value is a DWORD (bTaskState) that can be processed bitwise. The sTaskSel variable contains the task whose status is to be queried.
Network 6: By performing a bitwise logical operation with 16#0022 (corresponds to 2#0000 0000 xx1x xx1x) on the return value. Also refer to “Task States“ ST-documentation. Task stopped
Task suspended
It can be decided whether the task needs to be restarted. This is the case when the return value (bResAnd) after the logical operation is larger than 16#0000. © SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/44
Automation and Drives
Example for Beginners
Programming - Background Task (FBD) SIMOTION
Network 7:
Task
The result of the bit AND logical operation is evaluated in this network.
SIMOTION - Basic Information
If the return value is larger than 16#0000, the associated task must be restarted (boGo = TRUE).
Program Design Program Implementation
© SIEMENS AG 2009
Jump label (label is created in NW9)
Issued: 05/2009
Siemens I IA DT MC
Network 8: If the return value matches 16#0000, boGo becomes FALSE. This bypasses restarting the task. Jump label is “end“ (network 9)
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/45
Automation and Drives
Example for Beginners
Programming - Background Task (FBD) SIMOTION
Network 9:
Task
This network becomes active as soon as a task needs to be restarted.
SIMOTION - Basic Information
This system function is called “_restartTaskID“. The result of the function call is stored in “bRetStart“.
Program Design Program Implementation
Network 10: Network 10 is the “end“ jump label when no task needs to be started. “Jump label on/off“
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/46
Automation and Drives
Example for Beginners
Programming - Background Task (FBD) SIMOTION
The status of the FBD program can be monitored in this snapshot (monitor online).
Task SIMOTION - Basic Information
Network 1: The protective door is closed.
Program Design
Current value at runtime
Program Implementation
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
Network 2 and 3: The operating mode is “automatic“ (g_iMode = 1). Consequently, Motiontask_3 is stored in the sTaskSel variable.
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/47
Automation and Drives
Example for Beginners
Output cam configuration at the ejector valve Note: Output cams are stored in the “Nocken“ subdirectory under the directory of the associated axis. Here “Ejector“. Note: The 298.0 output does not need to be stored in I/O Browser.
SIMOTION
Task SIMOTION - Basic Information Program Design Program Implementation
“Valve“ output cam Output cam type Output cam cycle clock Type of the output cam value Fast output cams Active output Logical HW address © SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
Position-based output cam (related to “Ejector“) Interpolator Setpoints Yes Yes 298.0 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/48
Automation and Drives
Example for Beginners
Programming – Homing (Motion Task 2 MCC) 1/2 SIMOTION
Add “Homing“ MCC chart Declare “ret_resetAxis“ local variable in the start button (VAR variable type, DINT data type)
Task SIMOTION - Basic Information
Connect with “def_init“ Reset axes in the “ST zoom” (after emergency stop):
Program Design Program Implementation
“ret_resetAxis := _resetAxis (Axis := MasterAxis);“
“ret_resetAxis := _resetAxis (Axis := Conveyorbelt);“
“ret_resetAxis := _resetAxis (Axis := Ejector);“
Alternatively, the axis enable can also be removed and reapplied. Set g_boProtDoorOpen to “false“ Set g_rvMasterAxisOld to 0
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/49
Automation and Drives
Example for Beginners
Programming – Homing (Motion Task 2 MCC) 2/2 SIMOTION
Homing Zeros on the “MasterAxis“
Task
Enable “Conveyorbelt“
SIMOTION - Basic Information
Enable “Ejector“ Deactivate “Valve“ output cam
Program Design
“Active homing“ conveyor belt
Program Implementation
The initialization values can be retained
“Active homing“ ejector
The initialization values can be retained
Optionally, an initial position motion can also be connected here Set g_iMode variable to 1
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/50
Automation and Drives
Example for Beginners
Programming – Assignment to the execution system SIMOTION Open execution system with a doubleclick
Task
Use the arrow buttons to assign previously created programs to the execution levels
SIMOTION - Basic Information Program Design Program Implementation
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/51
Automation and Drives
Example for Beginners Programming – First test SIMOTION
Task SIMOTION - Basic Information
Open the “Homing“ program (SCOUT must be online) and start monitoring
Program Design
Switch SIMOTION D435 to RUN
Program Implementation
Optionally, the program can also be run in single-step mode
Both axes perform homing movements
The axes are homed after passage through the program
Note for the execution: The “bckFUP“ program in the background task starts the automatic operation as soon as the “g_iMode” variable is set to 1. Note: There are additional comments on the “FAQ“ slide
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/52
Automation and Drives
Example for Beginners
Programming – Automatic operation (Motiontask 3 in MCC) Add “Auto“ MCC chart
SIMOTION
Connect with “def_init“ Enable “MasterAxis“
Task
The conveyor belt starts with the positive edge of the “i_boStartBelt“ signal
SIMOTION - Basic Information
Synchronize the conveyor belt
Program Design
See parameterization (following slides)
Activate the “Valve“ output cam
Program Implementation
See parameterization (following slides)
If the set velocity changes, advance
g_rvMasterAxis g_rvMasterAxisOld
Start master axis position-controlled with “g_rvMasterAxis“ velocity For comparison, save the current velocity in „g_rvMasterAxisOld := g_rvMasterAxis“ Until-loop with “g_boProgEnd“ condition
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/53
Automation and Drives
Example for Beginners
Parameterization - Automatic (MCC) SIMOTION
Switch on the gearbox synchronism of the Conveyorbelt
Task SIMOTION - Basic Information Program Design
“Synchronize immediately”
Synchronization length 1
Synchronization reference master axis
Relative to the start position (Parameters tab)
Program Implementation
Activate the “Valve“ output cam
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
Switch-on position 0.1 mm
Switch-off position 0.4 mm
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/54
Automation and Drives
Example for Beginners Programming – Second test
The “Auto“ program must now also be assigned to the execution system
SIMOTION
As previously, the monitoring is now activated Task
Operation:
SIMOTION - Basic Information
Once the axes have been homed, the “Conveyorbelt“ starts to turn as soon as a positive edge of “i_boStartBelt“ is detected
Program Design Program Implementation
The “g_rvMasterAxis“ set velocity can be controlled in the Symbol Browser (control immediately) The automatic program responds only to a change to the set velocity © SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/55
Automation and Drives
Example for Beginners
Programming – Test using trace SIMOTION
Open the trace Variables from the program and from technological objects (e.g. axes) can be recorded in the trace
Task SIMOTION - Basic Information Program Design
Procedure: Select variables
Program Implementation
Load trace into the D435 Start D435 Start trace i_boStartBelt from 0 to 1
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/56
Automation and Drives
Example for Beginners Cam Form (with CAM Tool) SIMOTION
Task
“Cam_Ejector“ cam
SIMOTION - Basic Information
3 Elements 1 interpolation point left 1 straight line at 45° 1 interpolation point right
Program Design Program Implementation
Function of the segments Segment 1: Synchronize to the conveyor belt Segment 2: Synchronous operation with conveyor belt Segment 3: Desynchronize and return to the initial position (wait for the next defective part)
Segment 2 Segment 1 © SIEMENS AG 2009
Issued: 05/2009
Segment 3 Siemens I IA DT MC
Note: CAM Tool must be installed. SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/57
Automation and Drives
Example for Beginners Cam - Parameterization SIMOTION
Curve elements (straight line, interpolation point) are selected in the CAMtool function bar. Properties (right mouse click on the curve element)
Task SIMOTION - Basic Information
Straight line x1, y1 x2, y2
Program Design
0.1 0.4
Interpolation point left (create with symbol)
Program Implementation
x, y
0.0
Interpolation point right (create with symbol) x y
0.8 0.0
Scaling (Cam - “Target Device Parameter“ menu) Master Base scaling 360
Slave 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 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/58
Automation and Drives
Example for Beginners Programming – Eject by cam SIMOTION
Task SIMOTION - Basic Information Program Design Program Implementation Add “Eject“ MCC chart Synchronize the cam This motion task is started with a user interrupt The cam is processed acyclically
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/59
Automation and Drives
Example for Beginners
Programming – Stock outage detection (user interrupt in MCC) SIMOTION
Task SIMOTION - Basic Information Program Design Program Implementation Stock outage detection Add program “pEject” Specify condition for user interrupt in the execution system
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
Sensor at I299.2 (i_boEject) at TRUE means “eject” is coming (the right-hand red pushbutton on the D435 test rack)
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/60
Automation and Drives
Example for Beginners
Programming – Protective door (IPO synchronous in MCC) 1/2 SIMOTION
Monitoring the protective door Add “ProtDoor“ MCC chart
Task
Connect with “def_init“
SIMOTION - Basic Information
Query whether protective door closed (True = closed) If open, set “g_boProtDoorOpen“ bit, because axes must be explicitly reset after an emergency stop (see automatic operation (Motion Task 3 in MCC) 1/2)
Program Design Program Implementation
Query all Motion Tasks using “_GetStateOfTask (Motiontask_x) 16#0002“ (where x= 1 to 3) (test whether task “stopped“) All running tasks will be interrupted
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/61
Automation and Drives
Example for Beginners
Programming - Protective door (IPO synchronous in MCC) 2/2 SIMOTION
Monitoring the protective door Query the axes for stoppage using
Task
SIMOTION - Basic Information
“MasterAxis.motionstatedata.mo tionstate standstill“
“Conveyorbelt.motionstatedata. motionstate standstill“
“Ejector.motionstatedata.motion state standstill“
Program Design Program Implementation
If the axes are moving
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
Deactivate “Valve“ output cam
Stop axes using “Fast stop with maximum deceleration“
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/62
Automation and Drives
Example for Beginners
Programming - Test and diagnosis - Possibilities SIMOTION
Test the program execution
Task
Create a “Watchtable“ variable table. The variable can be moved with a right click in the Symbol Browser.
SIMOTION - Basic Information
Recording object variables such as actual position and actual velocity of an axis using “Trace“
Program Design Program Implementation
Test the program execution of a Motion Task using “Monitor” and “Single Step”
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/63
Automation and Drives
Example for Beginners FAQ SIMOTION
After STOP–RUN transition nothing moves, what is the problem? Have the tasks been correctly added to the execution system?
Task SIMOTION - Basic Information Program Design Program Implementation
Is the protective door (PI299.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:
Message frame type incorrectly set (SINAMICS and SIMOTION to 105).
Bus terminating resistances not set correctly (at “ON“ rather than at “OFF“ bus end points).
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?
© SIEMENS AG 2009
Check the settings in the “Homing Axes” mask
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/64
Automation and Drives
Example for Beginners ProTool/Pro Connection SIMOTION
Connectable variables: System variables
Task SIMOTION - Basic Information
Technology objects
Program Design Program Implementation
SIMOTION device
Prerequisite : ProTool in STEP7 integrated installed! D435
HMI (ProTool)
Global user variables I/O variables Device-global variables Unit variables
PROFIBUS DP Data exchange
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
example needs a display resolution of 1280 x1024
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/65
Automation and Drives
Example for Beginners Add „pHMIaus" ST source SIMOTION
Task SIMOTION - Basic Information Program Design Program Implementation
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/66
Automation and Drives
Example for Beginners
“pHMIaus" ST source in background task
SIMOTION
Task SIMOTION - Basic Information Program Design Program Implementation
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/67
Automation and Drives
Example for Beginners
ProTool/Pro connection (project) 1/2 SIMOTION
Create a new ProTool/Pro configuration with ProTool/Pro CS
Task
Close SIMOTION SCOUT
SIMOTION - Basic Information
Open ProTool/Pro CS “Project – Integrate in Step7-Proj”
Program Design
Select the source SIMOTION project (example on CD)
Program Implementation
© SIEMENS AG 2009
Here: PRO__00
Include in the introductory project
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/68
Automation and Drives
Example for Beginners
ProTool/Pro connection (project) 2/2 SIMOTION
Task SIMOTION - Basic Information Program Design Program Implementation
Under “Parameters ...”
Configuration of the network connection
Here “Ethernet”
Restore the symbols
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/69
Automation and Drives
Example for Beginners
ProTool/Pro connection (compile, generate, start RunTime) SIMOTION
Task SIMOTION - Basic Information Program Design Program Implementation
Compile project and regenerate Start ProTool RunTime
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/70
Automation and Drives
Example for Beginners
ProTool/Pro connection (picture) SIMOTION
Task SIMOTION - Basic Information Program Design Program Implementation
© SIEMENS AG 2009
Issued: 05/2009
Siemens I IA DT MC
SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/71
View more...
Comments