54114580 simotion example for beginners d435 en

Upload: claudiu-gogoseanu

Post on 02-Mar-2016

272 views

Category:

Documents


1 download

DESCRIPTION

hmi

TRANSCRIPT

  • SIMOTION

    SIEMENS AG 2009

    SIMOTIONExample

    for Beginners

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/2

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Disclaimer

    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.

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/3

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    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 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

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/4

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Machine

    diagrams

    Carton

    erector

    Prod

    uct

    feed

    Palletizer

    Sensor

    Conveyor

    belt

    Package (full)

    Package (empty)

    Extractor-

    electric

    travel

    -

    eject

    pneumatically

    Procedure

    notes

    are contained

    in the Program Design section

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/5

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Topology

    of the automation

    solution

    SIMOTION SCOUT

    ET 200 *

    MICROMASTER 420 *

    HMI MP270

    PROFIBUS DPCarton

    erector*Feed*

    Transport

    Extractor

    * Not considered in the example, but part of the complete plant

    D435

    1 FK7

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/6

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    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

    Start-up TaskStop

    Run

    Background Task Background TaskCall Motion Tasks

    (se-

    quential

    tasks)

    1

    Synchronous

    Tasks IPO -

    sync

    Task 1 IPO -

    sync

    Task 2 Monitor the emergency

    off criteria2

    System Int

    TasksSystem Int

    TasksInterrupt Tasks User Int

    Task 1 User Int

    Task 2 System Int

    TasksResponse to

    process

    signals

    3

    Shut-down

    Task

    Run

    Stop

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/7

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    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)

    Finished:= 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:= Target,

    nextCommand:=IMMEDIATELY,commandID:= PosCommandID);

    END_IF

    IF Pos.motionstatedata.motioncommand

    = MOTION_DONE THEN

    Fertig:= TRUE;END_IF

    Cyclical

    program section

    continued

    Advance

    command

    Query status

    pos. command

    Pos. command

    Advance

    command

    Query position

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/8

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    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

    Variable can be accessed

    from programs, FCs

    and FBs in a unit

    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)

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/9

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Solution guide

    Current situation

    Problem task (machine diagram)

    Topology concept with SIMOTION

    Program concept

    Technology objects

    Task structure

    Task relationships

    Variables

    Drives

    611U parameterization System environment

    Create device Specification of the possible DP cycle

    clock

    Creation of a hardware configuration

    Specification of the possible DP cycle clock

    Axis configuration

    Master axis

    Conveyor belt

    Extractor

    Output cam configuration

    Cam configuration

    Form

    Parameterization

    Programming, parameterization and test

    ProTool

    connection

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/10

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Technology objects

    Virtual master axis Positioning axis Rotary axis (modulo)

    Real axis - conveyor belt 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

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/11

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Task structure

    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) 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

    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

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/12

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Task relationships

    Start-up

    Background

    Motion Task 2

    User Interrupt

    IPO Sync

    Task

    Motion Task 3

    Start program

    pEject

    Motion Task 2

    Motion Task 3

    Interrupts the task

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/13

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Device-global variables None

    Unit-global variables Velocity of the leading axis Open protective door Program end Operating mode

    Locale variables None

    I/O Variables (symbol browser) Onboard inputs:

    dig_inputs (alle Eingnge)

    WORD (PIW298)

    i_boEject (Sensor) Bool PI299.2

    i_boProtDoorBool PI299.0

    i_boStartBeltBool PI299.1

    Fast outputs (output cam object) Onboard outputs:

    Ausschieber aktivNocken

    PQ298.0

    Example

    for Beginners Variables

    Naming variables

    Variables are named in accordance with the instructions from the SIMOTION ST V4.0 programming standards

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/14

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners HW configuration

    create device

    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

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/15

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners HW configuration

    Select cycle for internal interface

    e.g. 2ms increase factor to 8

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/16

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Net Pro

    The network configuration for PG is created automatically

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/17

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Configure drive 1

    Configure drive device Use unregulated infeed for

    SIMOTION D - demonstration kit

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/18

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Configure drive 1

    Select power section (dual-axis module) Select rating according to the rating plate

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/19

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Configure drive 1

    Motor with DRIVE-CLiQ no further details for the motor type required

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/20

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Configure drive 1

    Telegram type 105

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/21

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Configure drive 2

    Motor with SMCmotor type andspeed in accordancewith rating plate

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/22

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Configure drive 2

    Select encoder in accordance with rating plate, e.g. Endat

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/23

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Comparison with hardware configuration

    SINAMICS configurationComparison with the hardware configuration Entry of the I/O addresses by SIMOTION SCOUT

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/24

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Telegram extension for control unit in HW-Config

    Open hardware configuration

    Sinamics-integratedobject properties

    Activate

    Selectstandard telegram 1

    Save andcompile

    No further comparison with

    hardware configuration!!!

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/25

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Telegram for control unit

    Wiring of the digital inputs to the send telegram

    of the control unit Inputs available for Simotion

    Mouse click on

    interconnection icon:Control unit

    other interconnections

    r722

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/26

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Wiring of an input for the infeed

    (e.g. input 7)

    The wiring must be made for both drives

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/27

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Reduce the device connection voltage

    For SIMOTION D demo kit: Reduce the parameter 210 from 600 V to 345 V for single phase connectionMust be carried out for both drives

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/28

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners System cycle clocks

    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

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/29

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Axis configuration

    Master axis

    Create a virtual master axis

    Positioning axis

    Rotary axis Modulo Cycle length (product length)

    360

    Virtual axis

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/30

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Axis configuration

    -

    Conveyor

    belt

    Create a real Conveyorbelt slave axis

    Following axis

    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

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/31

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Axis configuration

    -

    Ejector

    Create a real Ejector slave axis

    Following axis

    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

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/32

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Axis configuration

    -

    Parameterization

    MasterAxis No modifications

    Conveyorbelt Homing

    Only zero mark Control (position-)

    Speed-precontrol activated

    Kv=50 ; DSC activated

    Ejector Homing

    Only zero mark Control (position-)

    Speed-precontrol activated

    Kv=50 ; DSC activated

    Note:

    The parameterization in the masks is made offline

    Position control parameterization

    (here Ejector)

    Homing

    parameterization

    (here Conveyorbelt)

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/33

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Programming

    -

    I/O variables

    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 partNote: The input in the Symbol Browser is made offline.

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/34

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Access to I/O in cyclical tasks

    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 variablesMust be made in all cyclical tasks

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/35

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Function

    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

    Example

    for Beginners Programming

    def_init

    (variable definition

    in ST)

    Programming

    Add ST program (source) def_init

    Add VAR_GLOBAL and END_VAR keywords

    PROGRAM init keyword

    Definition of the variables and default values

    g_boProgEnd

    g_boProtDoorOpen

    g_rVMasterAxis

    g_rVMasterAxisOld

    g_iMode

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/36

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Function

    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

    Example

    for Beginners Programming

    def_init

    (variable initialization

    in ST)

    Programming

    Add PROGRAM init and END_PROGRAM keywords

    Initialization of the variables for STOP RUN transition

    g_boProgEnd

    g_boProtDoorOpen

    g_rVMasterAxis

    g_rVMasterAxisOld

    g_iMode

    Save and compile

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/37

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Programming

    -

    Techfault

    Task (MCC)

    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.

    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).

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/38

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Programming

    Monitoring

    Motion Tasks

    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).

    The appropriate checkboxes are located in the Compiler tab.

    This setting can be made later in the Properties dialog box of the program.

    Basic procedure

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/39

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Programming

    Connection

    with another

    source (unit)

    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 MCC: in the Start node (button)

    LAD/FBD: program button

    Basic procedure

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/40

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Programming

    -

    Background Task

    (FUP)

    Add bckFUP

    LAD/FBD plan.

    The setup program and the automatic operation are started depending on the contents of the g_iModevariable

    g_iMode

    = 0 : Setup

    g_iMode

    = 1 : Automatic operation

    This occurs only when:

    The protective door is closed MotionTask_1 or Motiontask_2 is

    Stopped (performed), Waiting and has been suspended (emergency

    stop)

    Suspended (emergency stop)

    Note: If necessary, switch between LAD and FBD

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/41

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Programming

    Background Task (FBD)

    Network 1: Jump to the end if the drives have not yet been ramped up(no access possible to I/Os from Sinamics)

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/42

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Programming

    -

    Background Task (FBD)

    Create local variables bTaskState : Status of

    MotionTask_1 or MotionTask_2

    bRetStart : Return value of the _startTaskID function

    boResult : Result bit of the FBD networks

    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)

    Network 2: Query protective door contact No new tasks will be started if the protective

    door is open

    Label in NW9

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/43

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Programming

    -

    Background Task (FBD)

    Network 3 and network 4: 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.

    Add with empty

    box

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/44

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Programming

    -

    Background Task (FBD)

    Network 5: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.

    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.

    Network 6:

    Add with empty

    box

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/45

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Programming

    -

    Background Task (FBD)

    Network 7:

    The 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).

    Network 8:If the return value matches 16#0000, boGo

    becomes FALSE. This bypasses restarting the task. Jump label is end

    (network 9)

    Jump

    label

    (label

    is created

    in NW9)

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/46

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Programming

    -

    Background Task (FBD)

    Network 9:This network becomes active as soon as a task needs to be restarted.

    This system function is called _restartTaskID. The result of the function call is stored in bRetStart.

    Network 10:Network 10 is the end

    jump label when no task needs to be started.

    Jump label on/off

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/47

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Programming

    -

    Background Task (FBD)

    The status of the FBD program can be monitored in this snapshot (monitor online).

    Network 1: The protective door is closed.

    Network 2 and 3: The operating mode is automatic

    (g_iMode

    = 1). Consequently, Motiontask_3 is stored in the sTaskSel

    variable.

    Current

    value

    at runtime

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/48

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Output cam configuration

    at the ejector

    valve

    Valve output cam Output cam type Position-based output cam

    (related to Ejector)

    Output cam cycle clock Interpolator Type of the output

    cam value Setpoints

    Fast output cams Yes Active output Yes Logical HW address 298.0

    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.

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/49

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Programming

    Homing

    (Motion Task 2 MCC) 1/2

    Add Homing MCC chart Declare ret_resetAxis local variable in

    the start button (VAR variable type, DINT data type)

    Connect with def_init Reset axes in the ST zoom (after

    emergency stop):

    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

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/50

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Programming

    Homing

    (Motion Task 2 MCC) 2/2

    Homing

    Zeros on the MasterAxis Enable Conveyorbelt Enable Ejector Deactivate Valve output cam Active homing conveyor belt

    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

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/51

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Programming

    Assignment

    to the execution

    system

    Open execution system with a double-click

    Use the arrow buttons to assign previously created programs to the execution levels

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/52

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Programming

    First test

    Open the Homing program (SCOUT must be online) and start monitoring

    Switch SIMOTION D435 to RUN Both axes perform homing movements 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 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

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/53

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Programming

    Automatic operation

    (Motiontask

    3 in MCC)

    Add Auto MCC chart Connect with def_init Enable MasterAxis The conveyor belt starts with the positive edge of

    the i_boStartBelt signal

    Synchronize the conveyor belt See parameterization (following slides)

    Activate the Valve output cam 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

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/54

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Parameterization

    -

    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 position

    0.1 mm

    Switch-off position 0.4 mm

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/55

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Programming

    Second test

    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

    The Auto program must now also be assigned to the execution system

    As previously, the monitoring is now activatedOperation:

    Once the axes have been homed, the Conveyorbelt starts to turn as soon as a positive edge of i_boStartBelt is detected

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/56

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Programming

    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 variables Load trace into the D435 Start D435 Start trace i_boStartBelt from 0 to 1

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/57

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Cam Form (with CAM Tool)

    Cam_Ejector cam 3 Elements

    1 interpolation point left

    1 straight line at 45 1 interpolation point

    right

    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)

    Note:

    CAM Tool must be installed.Segment 1

    Segment 2

    Segment 3

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/58

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Cam -

    Parameterization

    Curve elements (straight line, interpolation point) are selected in the CAMtool function bar.

    Properties (right mouse click on the curve element) Straight line

    x1, y1 0.1 x2, y2 0.4

    Interpolation point left (create with symbol)

    x, y 0.0 Interpolation point right (create with

    symbol) x 0.8 y 0.0

    Scaling (Cam - Target Device Parameter menu) Master

    Base scaling 360 Slave

    Base scaling 10Note:

    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.

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/59

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Programming

    Eject

    by

    cam

    Add Eject MCC chart Synchronize the cam This motion task is started with

    a user interrupt

    The cam is processed acyclically

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/60

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Programming

    Stock outage

    detection

    (user

    interrupt

    in MCC)

    Stock outage detection

    Add program pEject Specify condition for user interrupt in the execution

    system

    Sensor at I299.2 (i_boEject) at TRUE means ejectis coming (the right-hand red pushbutton on the D435 test rack)

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/61

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Programming

    Protective

    door

    (IPO synchronous

    in MCC) 1/2

    Monitoring the protective door

    Add ProtDoor MCC chart Connect with def_init 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)

    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

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/62

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Programming

    -

    Protective

    door

    (IPO synchronous

    in MCC) 2/2

    Monitoring the protective door

    Query the axes for stoppage using MasterAxis.motionstatedata.mo

    tionstate 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

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/63

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Programming

    -

    Test and diagnosis

    -

    Possibilities

    Test the program execution

    Create a Watchtable variable 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

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/64

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners FAQ

    After STOPRUN transition nothing moves, what is the problem?

    Have the tasks been correctly added to the execution system? 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?

    Check the settings in the Homing Axes mask

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/65

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners ProTool/Pro

    Connection

    Connectable

    variables:

    PROFIBUS DP

    HMI (ProTool)

    Data exchange

    Prerequisite

    :

    ProTool

    in STEP7 integrated installed!

    Global user

    variables

    I/O variables

    Device-global

    variables

    Unit variables

    System variables

    Technology objects

    SIMOTION device

    D435

    example needs a display resolution

    of 1280 x1024

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/66

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners Add pHMIaus" ST source

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/67

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners pHMIaus"

    ST source in background task

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/68

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners ProTool/Pro

    connection

    (project) 1/2

    Create a new ProTool/Pro configuration with ProTool/Pro CS

    Close SIMOTION SCOUT Open ProTool/Pro CS Project Integrate in Step7-Proj Select the source SIMOTION project

    (example on CD)

    Here: PRO__00 Include in the introductory project

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/69

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners ProTool/Pro

    connection

    (project) 2/2

    Under Parameters ...

    Configuration of the network connection Here Ethernet

    Restore the symbols

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/70

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners ProTool/Pro

    connection

    (compile, generate, start RunTime)

    Compile project and regenerate Start ProTool RunTime

  • Automation and Drives

    SIMOTION

    Issued: 05/2009 Siemens I IA DT MC SIEMENS AG 2009 SIMOTION_EXAMPLE_FOR_BEGINNERS_D435.PPT/71

    Task

    SIMOTION - Basic Information

    Program Design

    Program Implementation

    Example

    for Beginners ProTool/Pro connection (picture)

    SIMOTIONExample for BeginnersDisclaimer of liabilityExample for Beginners Some preliminary commentsExample for BeginnersMachine diagramsExample for BeginnersTopology of the automation solutionExample for Beginners Execution systemExample for Beginners Comparison of cyclical and sequential programmingExample for Beginners Variable modelExample for Beginners Solution guideExample for Beginners Technology objectsExample for Beginners Task structureExample for Beginners Task relationshipsExample for Beginners VariablesExample for Beginners HW configuration create deviceExample for Beginners HW configurationExample for Beginners Net ProExample for Beginners Configure drive 1Example for Beginners Configure drive 1Example for Beginners Configure drive 1Example for Beginners Configure drive 1Example for Beginners Configure drive 2Example for Beginners Configure drive 2Example for Beginners Comparison with hardware configurationExample for Beginners Telegram extension for control unit in HW-ConfigExample for Beginners Telegram for control unitExample for Beginners Wiring of an input for the infeed (e.g. input 7)Example for Beginners Reduce the device connection voltageExample for Beginners System cycle clocksExample for Beginners Axis configuration Master axisExample for Beginners Axis configuration - Conveyor beltExample for Beginners Axis configuration - EjectorExample for Beginners Axis configuration - ParameterizationExample for Beginners Programming - I/O variablesExample for Beginners Access to I/O in cyclical tasksExample for Beginners Programming def_init (variable definition in ST)Example for Beginners Programming def_init (variable initialization in ST)Example for Beginners Programming - Techfault Task (MCC)Example for Beginners Programming Monitoring Motion TasksExample for BeginnersProgramming Connection with another source (unit)Example for Beginners Programming - Background Task (FUP)Example for Beginners Programming Background Task (FBD)Example for Beginners Programming - Background Task (FBD)Example for Beginners Programming - Background Task (FBD)Example for Beginners Programming - Background Task (FBD)Example for Beginners Programming - Background Task (FBD)Example for Beginners Programming - Background Task (FBD)Example for Beginners Programming - Background Task (FBD)Example for Beginners Output cam configuration at the ejector valveExample for Beginners Programming Homing (Motion Task 2 MCC) 1/2Example for Beginners Programming Homing (Motion Task 2 MCC) 2/2Example for Beginners Programming Assignment to the execution systemExample for Beginners Programming First testExample for Beginners Programming Automatic operation (Motiontask 3 in MCC)Example for Beginners Parameterization - Automatic (MCC) Example for Beginners Programming Second testExample for Beginners Programming Test using traceExample for Beginners Cam Form (with CAM Tool)Example for Beginners Cam - ParameterizationExample for Beginners Programming Eject by camExample for Beginners Programming Stock outage detection (user interrupt in MCC)Example for Beginners Programming Protective door (IPO synchronous in MCC) 1/2Example for Beginners Programming - Protective door (IPO synchronous in MCC) 2/2Example for Beginners Programming - Test and diagnosis - PossibilitiesExample for Beginners FAQExample for Beginners ProTool/Pro ConnectionExample for Beginners Add pHMIaus" ST sourceExample for Beginners pHMIaus" ST source in background taskExample for Beginners ProTool/Pro connection (project) 1/2Example for Beginners ProTool/Pro connection (project) 2/2Example for Beginners ProTool/Pro connection (compile, generate, start RunTime)Example for Beginners ProTool/Pro connection (picture)