53705461 simotion diagnostics v2 0 en

Upload: abirajesh

Post on 02-Apr-2018

236 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    1/43

    Applications & ToolsAnswers for industry.

    SIMOTION Diagnosing station

    failures and m odule statesSIMOTION

    Application June 2013

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    2/43

    2Diagnosing station failures and module states

    Version V2.0, Entry ID: 53705461

    CopyrightS

    iemensAG2013Allrightsreserved

    Siemens Indust ry Online Support

    This article is taken from the Siemens Industry Online Support. The following linktakes you directly to the download page of this document:

    http://support.automation.siemens.com/WW/view/en/53705461

    Caution

    The functions and solutions described in this article confine themselves to therealization of the automation task predominantly. Please take into accountfurthermore that corresponding protective measures have to be taken up in thecontext of Industrial Security when connecting your equipment to other parts of theplant, the enterprise network or the Internet. Further information can be foundunder the Item-ID 50203404.

    http://support.automation.siemens.com/WW/view/en/50203404

    http://support.automation.siemens.com/WW/view/en/53705461http://support.automation.siemens.com/WW/view/en/50203404http://support.automation.siemens.com/WW/view/en/50203404http://support.automation.siemens.com/WW/view/en/53705461
  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    3/43

    Diagnosing station failures and module statesVersion V2.0, Entry ID: 53705461 3

    CopyrightS

    iemensAG2013Allrightsreserved

    s

    SIMOTION

    Diagnosing station failures andmodule states

    Task 1

    Solution 2

    Functional mechanismsof this application 3

    Startup of theapplication 4

    Operating theapplication 5

    References 6

    Contacts 7

    History 8

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    4/43

    Warranty and liability

    4Diagnosing station failures and module states

    Version V2.0, Entry ID: 53705461

    CopyrightS

    iemensAG2013Allrightsreserved

    Warranty and liabili ty

    Note The Application Examples are not binding and do not claim to be completeregarding the circuits shown, equipping and any eventuality. The ApplicationExamples do not represent customer-specific solutions. They are only intendedto provide support for typical applications. You are responsible for ensuring thatthe described products are used correctly. These application examples do notrelieve you of the responsibility to use safe practices in application, installation,operation and maintenance. When using these Application Examples, yourecognize that we cannot be made liable for any damage/claims beyond theliability clause described. We reserve the right to make changes to theseApplication Examples at any time without prior notice.If there are any deviations between the recommendations provided in theseapplication examples and other Siemens publications e.g. Catalogs thecontents of the other documents have priority.

    We do not accept any liability for the information contained in this document.

    Any claims against us based on whatever legal reason resulting from the use ofthe examples, information, programs, engineering and performance data etc.,described in this Application Example shall be excluded. Such an exclusion shallnot apply in the case of mandatory liability, e.g. under the German Product LiabilityAct (Produkthaftungsgesetz), in case of intent, gross negligence, or injury of life,body or health, guarantee for the quality of a product, fraudulent concealment of adeficiency or breach of a condition which goes to the root of the contract(wesentliche Vertragspflichten). The damages for a breach of a substantialcontractual obligation are, however, limited to the foreseeable damage, typical forthe type of contract, except in the event of intent or gross negligence or injury to

    life, body or health. The above provisions do not imply a change of the burden ofproof to your detriment.

    Any form of duplication or distribution of these Application Examples or excerptshereof is prohibited without the expressed consent of Siemens Industry Sector.

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    5/43

    Table of contents

    Diagnosing station failures and module statesVersion V2.0, Entry ID: 53705461 5

    CopyrightS

    iemensAG2013Allrightsreserved

    Table of contentsWarranty and l iabi li ty ............................................................................................... 41 Task................................................................................................................. 6

    1.1 Overview ........................................................................................... 62 Solution........................................................................................................... 7

    2.1 Overview of the overall solution ......................................................... 72.2 Description of the core functionality.................................................... 82.3 Hardware and software components used ....................................... 10

    3 Functional mechanisms of this application ................................................ 113.1 User structure "gasMachineNetwork" ............................................... 113.2 FBGetStateOfAllStationsAtNetwork ................................................. 163.2.1 Functionality .................................................................................... 163.2.2 Schematic LAD representation......................................................... 163.2.3 Parameters ...................................................................................... 173.2.4 Timing diagram ................................................................................ 173.2.5 Fault messages ............................................................................... 183.3 FBInitNetworkDiagnosticsStructure .................................................. 193.3.1 Functionality .................................................................................... 193.3.2 Schematic LAD representation......................................................... 203.3.3 Parameters ...................................................................................... 203.3.4 Timing diagram ................................................................................ 213.3.5 Fault messages ............................................................................... 223.3.6 Transfer structure "addressDetection" .............................................. 223.3.7 Transfer structure "counterArray" ..................................................... 253.3.8 Transfer structure "eventCounter" .................................................... 273.4 FCMachinePeripheralFailureHandling .............................................. 293.4.1 Functionality .................................................................................... 293.4.2 Schematic LAD representation......................................................... 303.4.3 Parameters ...................................................................................... 313.4.4 Fault messages ............................................................................... 32

    4 Startup of the application............................................................................. 334.1 Overview ......................................................................................... 334.2 Integrating ST sources ..................................................................... 334.3 Linking in the programs.................................................................... 34

    5 Operating the application............................................................................. 365.1 Adapting the value of the global constants ....................................... 365.2 Automatic execution of the diagnostic functionality ........................... 375.3 Manually initiating the diagnostics functionality................................. 395.4 Manually entering the network diagnostic addresses ........................ 39

    6 References .................................................................................................... 436.1 Internet links .................................................................................... 43

    7 Contacts........................................................................................................ 438 History .......................................................................................................... 43

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    6/43

    1 Task

    1.1 Overview

    6Diagnosing station failures and module states

    Version V2.0, Entry ID: 53705461

    CopyrightS

    iemensAG2013Allrightsreserved

    1 Task

    1.1 Overview

    Overview of the automation task

    The following figure provides an overview of the automation task.

    Fig. 1-1

    Descripti on of the automation task

    The IO devices connected to a SIMOTION control should be monitored for failureand module state changes. This should be implemented during the SIMOTIONapplication runtime.

    The status data for PROFINET IO as well as for the PROFIBUS DP nodes shouldbe stored in a structure for the user.

    All stations and their modules should be listed in the structure, separated according

    to the bus segments configured at the SIMOTION control system. The user shouldsee there for the associated configured node whether an error is present at one orseveral modules or whether the node has failed.

    In order to track the error over time, the error information as well as a certainnumber of errors should also be stored in the structure associated with the station.

    SIMOTION

    I/Os Drive I-Device

    I/Os Drive I-Slave

    PROFINET

    PROFIBUS

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    7/43

    2 Solution

    2.1 Overview of the overall solution

    Diagnosing station failures and module statesVersion V2.0, Entry ID: 53705461 7

    CopyrightS

    iemensAG2013Allrightsreserved

    2 Solution

    2.1 Overview of the overall solution

    Schematic diagram

    The following schematic diagram shows the most important components of thesolution:

    Fig. 2-1

    Advantages

    This application described here offers you the following advantages:

    High-performance diagnostics of PROFINET IO devices as well as PROFIBUSDP slaves belonging to a SIMOTION control to the module level

    The actual states of the stations are determined once during the runtime of theSIMOTION application

    Diagnostic data is stored in a user structure

    The user structure is automatically updated using fault information from thePer i pher al Faul t Task

    It is also possible to access the diagnostics data from HMIs

    PROFINET

    PROFIBUS SIMOTIOND435-2 DP/PN(+ CBE30-2)

    ET200SIM 151 DP HF

    SINAMICS G120CU240E-2 DP

    SINAMICS S120CU310-2 PN

    ET200SIM151-3 PN HF

    SIMATICCPU317-2 PN/DP

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    8/43

    2 Solution

    2.2 Description of the core functionality

    8Diagnosing station failures and module states

    Version V2.0, Entry ID: 53705461

    CopyrightS

    iemensAG2013Allrightsreserved

    2.2 Descript ion of the core functionality

    This application example shows a way of simply diagnosing station failures or

    changes in state of individual modules of a station.The PROFINET IO devices and PROFIBUS DP slaves operated using aSIMOTION control system and configured in the hardware configuration arediagnosed (incl. I-Devices / I-Slaves).

    During the application runtime the actual state of all configured stations (as well astheir associated modules) is determined once and saved in a user structure. Thestructure is subsequently updated by evaluating what is known as the "Task-Start-Information (TSI)" of the Per i pher al Faul t Task and copying the faultinformation to the corresponding location in the user structure.

    The ST sources required for the diagnostics are included in the ZIP archive53705461_SI MOTI ON_Di agnost i cs_V2_0. zi p that is supplied.

    System functions used

    The following system functions provided by SIMOTION are used in the applicationexample:

    _getSegmentIdenti ficat ion()All configured bus segments are determined.

    _getStateOfAl lDpStations()The status of all configured devices is determined.

    _getNextLogAddress()All configured logical addresses of a bus segment are determined.

    Constants used

    Global constants, which the user can adapt to further optimize diagnostics are usedin the application example.

    The following constants are located in the ST sourcef Machi neNet wor kDi agnost i cs:

    NUMBER_OF_NETWORKSNumber of bus segments that are to be diagnosed(default: 5, maximum: 8).

    HIGHEST_STATION_ADDRESS_AT_NETWORK

    Highest station address of all of the configured bus segments. All stations witha station address less or equal to this constant are diagnosed.(default: 128, maximum: 128)

    HIGHEST_NUMBER_OF_MODULES_PER_STATIONHighest number of modules ( I/O addresses) for each station for allconfigured bus segments, whose status is to be determined. For all stationswith a number of modules ( I/O addresses) smaller than or equal to thisconstant the module states are diagnosed.(default: 64, maximum: 255)

    NUMBER_OF_STORED_EVENTS_PER_STATIONNumber of events that should be stored for each station.(default: 8, maximum 255)

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    9/43

    2 Solution

    2.2 Description of the core functionality

    Diagnosing station failures and module statesVersion V2.0, Entry ID: 53705461 9

    CopyrightS

    iemensAG2013Allrightsreserved

    Overview of the sources/blocks

    Table 2-1

    Sources Programming language Know-how

    protection

    pMachineNetworkDiagnostics ST No

    fMachineNetworkDiagnostics ST No

    Function/function block Property Must beadapted to the

    application

    FBGetStateOfAllStationsAtNetwork This function block determinesthe actual states of allconfigured stations.

    No

    FBInitNetworkDiagnosticsStructure This function block is used to

    initialize the diagnosticsstructure.

    No

    FCMachinePeripheralFailureHandling This function is used toevaluate the task startinformation of thePeri pher al Faul t Task.

    No

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    10/43

    2 Solution

    2.3 Hardware and software components used

    10Diagnosing station failures and module states

    Version V2.0, Entry ID: 53705461

    CopyrightS

    iemensAG2013Allrightsreserved

    2.3 Hardware and software components used

    The application example has been created with the following components:

    Hardware components

    Table 2-2

    Component Qty. Order number Note

    SIMOTION D435-2 DP/PN 1 6AU1 435-2AD00-0AA0 V 4.3 SP1 HF12

    SIMATIC 317-2 PN/DP(I-Device)

    1 6ES7 317-2EK14-0AB0 V3.2.7

    ET200S HF (PROFINET) 1 6ES7 151-3BA23-0AB0 V 7.0.1

    SINAMICS S120 CU310-2 PN 1 6SL3 040-1LA01-0AA0 V 4.6 HF3

    ET200S HF (PROFIBUS) 1 6ES7 151-1BA00-0AB0 V1.1.3

    SINAMICS G120 CU240E-2 DP 1 6SL3 244-0BB12-1PA1 V4.6 HF3

    Standard so ftware components

    Table 2-3

    Component Qty. Order number Note

    STEP7 1 6ES7 810-4CC10-0YA7 V5.5 SP3

    SIMOTION SCOUT 1 6AU1 810-1BA43-1XA0 V4.3 SP1 HF12

    SSP SINAMICS 1 --- V4.6 (Download)

    SSP SINAMICS G120 1 --- V4.6 (Download)

    Sample files and projectsThe list below contains all the files and projects used in this example.

    Table 2-4

    Component Note

    53705461_SIMOTION_Diagnostics_V2_0_en.pdf This document

    53705461_SIMOTION_Diagnostics_V2_0.zip ZIP archive with the ST sourcesrequired for the diagnostics

    http://support.automation.siemens.com/WW/view/de/26233208http://support.automation.siemens.com/WW/view/de/26233208http://support.automation.siemens.com/WW/view/de/26233208http://support.automation.siemens.com/WW/view/de/26233208
  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    11/43

    3 Functional mechanisms of this application

    3.1 User structure "gasMachineNetwork"

    Diagnosing station failures and module statesVersion V2.0, Entry ID: 53705461

    11

    CopyrightS

    iemensAG2013Allrightsreserved

    3 Funct ional mechanisms of this application

    3.1 User structure "gasMachineNetwork"

    The user structure gasMachi neNet wor k comprises an array, with the structuresNet wor kType (seeTable 3-1) with a dynamic number of elements for theindividual networks of a SIMOTION control system. The size of the array isdependent on the value of the NUMBER_OF_NETWORKS constant.

    All of the data relevant for the user are saved in this structure, which are requiredto diagnose the networks of a SIMOTION control as well as its stations.

    Structure sNetworkType

    Table 3-11

    Structure Parameters Data type P

    type

    1)M/O

    2)Initial value Description

    sNetworkType

    eTypeOfNetwork

    EnumNetworkType

    OUT --- UNKNOWNDisplays thenetwork type

    u8NumberOfStationsAtNetwork

    USINT OUT --- 0

    Number ofconfiguredstations in thenetwork

    u8NumberOfDisturbed

    Stations

    USINT OUT --- 0

    Number ofcurrently faulty

    stations in thenetwork

    u8LastDisturbedStation

    USINT OUT --- 0Display of the lastfaulty station inthe network

    asStation

    ARRAY[1.HI GHEST_...]

    OF sStateOfDevicesAt

    NetworkType

    OUT --- ---

    Array of thestructure with adynamic numberof elements forthe stations in thenetwork; the arraysize depends onthe value of theconstant.

    (seeTable 3-2)

    1) Parameter types:

    IN = input parameters, OUT = output parameters, IN/OUT = in/out parameters2)

    Parameter sort:

    M =mandatory parameter, O =optional parameter

    1ARRAY [1.HI GHEST_STATI ON_ADDRESS_AT_NETWORK] OF sStateOfDevicesAtNetworkType

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    12/43

    3 Functional mechanisms of this application

    3.1 User structure "gasMachineNetwork"

    12Diagnosing station failures and module states

    Version V2.0, Entry ID: 53705461

    CopyrightS

    iemensAG2013Allrightsreserved

    Structure sStateOfDevicesAtNetworkType

    Table 3-22

    Structure Parameters Data type P

    type

    1)M/O

    2)Initial

    value

    Description

    sStateOf

    DevicesAt

    NetworkType

    i32DiagnosticAddress

    DINT OUT --- 0Diagnostic addressof the station

    eActualStateEnum

    StateOfDpStation

    OUT ---NO_VALID_STATE

    Current state of thestation

    u32InterruptId

    UDINT OUT --- 0

    Fault, which was

    signaled for thisstation in thePeri pher al - Faul t Task

    b16EventClass

    WORD OUT --- 16#00_00

    Event class(depending onu32I nt er r upt - I d) as additionalfault information

    b16FaultId WORD OUT --- 16#00_00

    Fault identification(depending onu32I nt er r upt - I d and

    b16Event Cl ass)as additional faultinformation

    b32Details DWORD OUT ---16#00_00_00_00

    Detailedinformation(depending onu32I nt er r upt - I d andb16Event Cl ass)on the prevailingfault

    u8NumberOfDisturbed

    Modules

    USINT OUT --- 0

    Number of currentlyfaulty modules (I/O addresses) ofthe station

    u8LastDisturbedModule

    USINT OUT --- 0Number of the lastfaulty module of thestation

    sEventHistory

    sEventHistoryType

    OUT --- ---

    Structure, which isused to save thefaults at the station(seeTable 3-3)

    2ARRAY [1..HI GHEST_NUMBER_OF_ MODULES_PER_STATI ON] OF sModuleType

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    13/43

    3 Functional mechanisms of this application

    3.1 User structure "gasMachineNetwork"

    Diagnosing station failures and module statesVersion V2.0, Entry ID: 53705461

    13

    CopyrightS

    iemensAG2013Allrightsreserved

    Structure Parameters Data type Ptype

    1)M/O

    2)Initialvalue

    Description

    sStateOf

    DevicesAt

    NetworkType

    asModule

    ARRAY[1..HI GHEST_...]

    OFsModuleType

    OUT --- ---

    Array of thestructure with adynamic number ofelements for themodules ( I/Oaddresses) of thestation; array sizedepends on thevalue of the

    constant(seeTable 3-5)1)

    Parameter types:

    IN = input parameters, OUT = output parameters, IN/OUT = in/out parameters2)

    Parameter sort:

    M =mandatory parameter, O =optional parameter

    Structure sEventHistoryType

    Table 3-33

    Structure Parameters Data type P

    type

    1)M/O

    2)Initial

    value

    Description

    sEventHistoryType

    u16LastEventIndex

    UINT OUT --- 0

    Pointer to the lastfault entry in thearrayasEvent ,that serves as ringbuffer

    asEventARRAY

    [1..NUMBER_...]OF sEventType

    OUT --- ---

    Array of thestructure with adynamic number ofelements to savestation faults; arraysize depends onthe value of theconstant(seeTable 3-4)

    1) Parameter types:

    IN = input parameters, OUT = output parameters, IN/OUT = in/out parameters2)

    Parameter sort:

    M =mandatory parameter, O =optional parameter

    3ARRAY [1..NUMBER_OF_STORED_EVENTS_ PER_STATI ON] OF sEventType

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    14/43

    3 Functional mechanisms of this application

    3.1 User structure "gasMachineNetwork"

    14Diagnosing station failures and module states

    Version V2.0, Entry ID: 53705461

    CopyrightS

    iemensAG2013Allrightsreserved

    Structure sEventType

    Table 3-4

    Structure Parameters Data type P

    type

    1)M/O

    2)Initial

    value

    Description

    sEventType

    dtEventOccurred

    DT OUT ---DT#0001-

    01-01-0:0:0

    Instant time thatPeri pher al - Faul t Task iscalled (i.e. theinstant in time ofthe coming/goingfault)

    u32

    InterruptIdUDINT OUT --- 0

    Fault, which wassignaled for thisstation in thePeri pher al - Faul t Task

    b16EventClass

    WORD OUT --- 16#00_00

    Event class(depending onu32I nt er r upt I d)as additional faultinformation

    b16FaultId WORD OUT --- 16#00_00

    Fault identification(depending onu32I nt er r upt I dandb16Event Cl ass)as additional fault

    information

    b32Details DWORD OUT ---16#00_00_00_00

    Detailedinformation(depending onu32I nt er r upt I dandb16Event Cl ass)on the prevailingfault

    u8DisturbedModule

    USINT OUT --- 0Number of modulesat which the faulthas occurred

    1) Parameter types:

    IN = input parameters, OUT = output parameters, IN/OUT = in/out parameters2)

    Parameter sort:

    M =mandatory parameter, O =optional parameter

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    15/43

    3 Functional mechanisms of this application

    3.1 User structure "gasMachineNetwork"

    Diagnosing station failures and module statesVersion V2.0, Entry ID: 53705461

    15

    CopyrightS

    iemensAG2013Allrightsreserved

    Structure sModuleType

    Table 3-5

    Structure Parameters Data type Ptype1)

    M/O2)

    Initialvalue

    Description

    sModuleType

    i32LogicalAddress

    DINT OUT --- 0Logical address ofthe module

    eAddressType

    EnumModuleType

    OUT ---NO_VALID_TYPE

    Type of logicaladdress

    u32LengthOfAddress

    UDINT OUT --- 0Length of themodule address inbytes

    u32InterruptId

    UDINT OUT --- 0

    Fault, which was

    signaled for thismodule in thePeri pher al - Faul t Task

    b16EventClass

    WORD OUT --- 16#00_00

    Event class(depending onu32I nt er r upt I d)as additional faultinformation

    b16FaultId WORD OUT --- 16#00_00

    Fault identification(depending onu32I nt er r upt I dand

    b16Event Cl ass)as additional faultinformation

    b32Details DWORD OUT ---16#00_00_00_00

    Detailedinformation(depending onu32I nt er r upt I dandb16Event Cl ass)on the prevailingfault

    1)Parameter types:

    IN = input parameters, OUT = output parameters, IN/OUT = in/out parameters2) Parameter sort:

    M =mandatory parameter, O =optional parameter

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    16/43

    3 Functional mechanisms of this application

    3.2 FBGetStateOfAllStationsAtNetwork

    16Diagnosing station failures and module states

    Version V2.0, Entry ID: 53705461

    CopyrightS

    iemensAG2013Allrightsreserved

    3.2 FBGetStateOfAllStationsAtNetwork

    The function block FBGetStat eOf Al l St at i onsAt Network supplies the states

    of all configured stations of a network. PROFIBUS DP and PROFINET IO nodes(participants) are diagnosed.

    3.2.1 Functionality

    The block is programmed for cyclic operation.

    The function is started using a positive edge at the execut e input.

    The block is called by specifying the diagnostics address(di agAddr essOf Net wor k) of the corresponding network.

    The states of all stations configured on this network are read out.

    Internally, the system function_get Stat eOf Al l DpSt at i ons( ) is called.

    If an error occurs while reading out the stations, this is indicated at the error output. The error cause can be traced using the er r or I d that is also output.

    The various error IDs can be reviewed in the online help for SIMOTION for the

    _get Stat eOf Al l DpSt at i ons( ) system function.

    The done output indicates that the function block has been successfullyexecuted. The results of the function block are only located in the userstructure gasMachi neNet wor k for done = TRUE.

    3.2.2 Schematic LAD representation

    Fig. 3-14

    4ARRAY [1..HI GHEST_STATI ON_ADDRESS_ AT_NETWORK] OF sStateOfDevicesAtNetworkType

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    17/43

    3 Functional mechanisms of this application

    3.2 FBGetStateOfAllStationsAtNetwork

    Diagnosing station failures and module statesVersion V2.0, Entry ID: 53705461

    17

    CopyrightS

    iemensAG2013Allrightsreserved

    3.2.3 Parameters

    Table 3-65

    Element P type1)

    Data type M/O2)

    Initial

    value

    Meaning

    execute IN BOOL M FALSETRUE:

    Start of the functionality

    diagAddressOf

    NetworkIN UDINT M 0

    Diagnostics address of thenetwork to be diagnosed

    stateOfStations IN/OUT

    ARRAY[1..HI GHEST_...]

    OFsStateOfDevices

    AtNetworkType

    M -

    Transfer structure for thestatus of the stations and theirmodules(also seeTable 3-2)

    numberOf

    Stations IN/OUT INT M 0

    Transfer structure for the

    number of stations in thenetwork

    done OUT BOOL - FALSE J ob being processed

    busy OUT BOOL - FALSE Processing completed

    error OUT BOOL - FALSETRUE:Error when calling thefunction

    errorId OUT DWORD -16#00_00

    _00_00Error code

    1)Parameter types:

    IN = input parameters, OUT = output parameters, IN/OUT = in/out parameters2)

    Parameter sort:

    M =mandatory parameter, O =optional parameter

    3.2.4 Timing diagram

    Fig. 3-2

    5ARRAY [1..HI GHEST_STATI ON_ADDRESS_ AT_NETWORK] OF sStateOfDevicesAtNetworkType

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    18/43

    3 Functional mechanisms of this application

    3.2 FBGetStateOfAllStationsAtNetwork

    18Diagnosing station failures and module states

    Version V2.0, Entry ID: 53705461

    CopyrightS

    iemensAG2013Allrightsreserved

    Block processing without error

    The block is started with a rising edge at the input execut e.

    When starting, the block indicates that it is being actively processed withbusy = TRUE.

    When the block processing has been completed, output busy = FALSE.

    At the same time, the block signals using done = TRUE that the blockfunctionality has been successfully completed.

    Ifexecut e is set again from FALSE toTRUE before the function is completed,the current processing is canceled and the block again starts to execute thefunction.

    All outputs are initialized.

    Block processing with error

    The block is started with a rising edge at execut e.

    When starting, the block indicates that it is being actively processed withbusy = TRUE.

    An error in the block processing is then detected.

    This error is indicated by er r or = TRUE and a corresponding ID is displayedat the er r or I Doutput.

    The block can be restarted with execut e = TRUE.

    3.2.5 Fault messages

    Table 3-7

    Fault number[HEX]

    Meaning

    16#0000 No error

    16#1005 Internal error: The internal step bit memory of the FB has an invalidvalue

    16#1006 Internal error: The runtime of the_getStat eOf Al l DpSt at i ons( ) function has exceeded themaximum time of 20 seconds

    16#FFFF80xx See the online help for the system function_getStat eOf Al l DpSt at i ons( )

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    19/43

    3 Functional mechanisms of this application

    3.3 FBInitNetworkDiagnosticsStructure

    Diagnosing station failures and module statesVersion V2.0, Entry ID: 53705461

    19

    CopyrightS

    iemensAG2013Allrightsreserved

    3.3 FBInitNetworkDiagnosticsStructure

    The function block FBI ni t NetworkDi agnost i csSt r uctur e is used to initialize

    the user structure gasMachi neNet wor k.

    Using the system function_get Segment I dent i f i cat i on( ) networksconfigured for a SIMOTION control and their associated diagnostic addresses aredetermined once. Users can also specify diagnostic addresses.

    For each determined network, all of the associated addresses (i.e. diagnosticaddresses and I/O addresses) are determined using the

    _get NextLogAddr ess( ) system function. The address information is savedassociated with the network and associated with the station in the user structuregasMachi neNet wor k as well as associated with the address in thegsCount erAr r ay structure. This subsequently guarantees that the data arequickly updated in the gasMachi neNet wor k user structure.

    Using the FBGetStateOf Al l Stat i onsAt Network function block, the states ofthe stations in the network are subsequently determined, and also saved in thegasMachi neNet wor k user structure.

    The function block has now been executed and when required, can be re-initiatedby the user.

    3.3.1 Functionality

    The block is configured for cyclic operation.

    Because it is not a time-critical application, the BackgroundTask should

    preferably be used for this purpose. The function is started using a positive edge at the execut e input.

    Using the addr essDetect i on input of the function block, the user can defineas to whether the diagnostic addresses for the networks configured for theSIMOTION control are manually specified or automatically determined.

    The busy output indicates that the block is being executed.

    After the block has been completed, the done = TRUE output indicates thatvalid data are available.

    If an error occurs while executing the block, then this is indicated at the error output. The error cause can then be traced using the error ID at the er r or I doutput.

    Internally, the system functions_get Segment I dent i f i cat i on( ) ,_get NextLogAddr ess( ) and_get Stat eOf Al l DpSt at i ons( ) are calledin the form of the FBGetStat eOf Al l St at i onsAtNet work function block.

    The address information of the addresses determined by the function block(i.e. in which network and which station the address is located) is saved in thegsCounterAr r ay structure. This structure comprises an array with a size of[ 0. . 16383] .

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    20/43

    3 Functional mechanisms of this application

    3.3 FBInitNetworkDiagnosticsStructure

    20Diagnosing station failures and module states

    Version V2.0, Entry ID: 53705461

    CopyrightS

    iemensAG2013Allrightsreserved

    In this case, for example, the information of address 256 is saved in the arrayelement 256, the information of address 16383 in the array element16383.

    This procedure guarantees that data in the gasMachi neNet wor k userstructure are quickly updated.

    The first address of a station to be newly determined is saved as diagnosticsaddress, and all other addresses as "module addresses" of the station in thegasMachi neNet wor k user structure.

    3.3.2 Schematic LAD representation

    Fig. 3-36

    3.3.3 Parameters

    Table 3-8

    Element Ptype

    1)Data type M/O

    2)Initialvalue

    Meaning

    execute IN BOOL M FALSE TRUE: Start of the functionality

    addressDetection

    INsAddressDetection

    TypeM -

    Transfer structure to define theautomatic determination of thenetwork diagnostic addressesfor manual input(see Chapter 3.3.6)

    counterArray IN/OUTsCounter

    ArrayTypeM -

    Transfer structure to save all ofthe address information(see Chapter 3.3.7)

    network IN/OUT

    ARRAY[1..NUMBER_...]

    OF sNetwork

    Type

    M -

    Transfer structure to save thedetermined data in the userstructure(see alsoTable 3-1)

    eventCounter IN/OUT

    ARRAY[1..NUMBER_...]

    OF sEvent

    Counter

    Type

    M -

    Transfer structure to clear theerror account of the stationswhen the block functionality isre-initiated(see Chapter 3.3.8)

    6ARRAY [1..NUMBER_OF_NETWORKS] OF sNetworkType / sEventCounterType

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    21/43

    3 Functional mechanisms of this application

    3.3 FBInitNetworkDiagnosticsStructure

    Diagnosing station failures and module statesVersion V2.0, Entry ID: 53705461

    21

    CopyrightS

    iemensAG2013Allrightsreserved

    Element Ptype

    1)Data type M/O

    2)Initialvalue

    Meaning

    done OUT BOOL - FALSETRUE:

    Function block being processed

    busy OUT BOOL - FALSE

    TRUE:

    Function block successfullycompleted

    error OUT BOOL - FALSETRUE:

    Function block cancelled witherror

    errorId OUT DWORD -16#00_00

    _00_00Error code

    1) Parameter types:

    IN = input parameters, OUT = output parameters, IN/OUT = in/out parameters2) Parameter sort:

    M =mandatory parameter, O =optional parameter

    3.3.4 Timing diagram

    Fig. 3-4

    Block processing without error

    The block is started with a rising edge at the input execut e.

    When starting, the block indicates that it is being actively processed withbusy = TRUE.

    When the block processing has been completed, output busy = FALSE.

    At the same time, the block signals using done = TRUE that the blockfunctionality has been successfully completed.

    Ifexecut e is set again from FALSE toTRUE before the function is completed,the current processing is canceled and the block again starts to execute thefunction.

    All outputs are initialized.

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    22/43

    3 Functional mechanisms of this application

    3.3 FBInitNetworkDiagnosticsStructure

    22Diagnosing station failures and module states

    Version V2.0, Entry ID: 53705461

    CopyrightS

    iemensAG2013Allrightsreserved

    Block processing with error

    The block is started with a rising edge at execut e.

    When starting, the block indicates that it is being actively processed with

    busy = TRUE. An error in the block processing is then detected.

    This error is indicated by er r or = TRUE and a corresponding ID is displayedat the er r or I Doutput.

    The block can be restarted with execut e = TRUE.

    3.3.5 Fault messages

    Table 3-9

    Fault number [HEX] Meaning

    16#0000 No error

    16#1005 Internal error: The internal step bit memory of the FB has aninvalid value

    16#FFFF80xx See the online help for the system functions

    _get SegmentI dent i f i cat i on( )

    _getNext LogAddr ess( )

    _get Stat eOf Al l DpSt at i ons( )

    3.3.6 Transfer structure "addressDetection"

    Every configured network of a SIMOTION control has its own unique diagnosticsaddress; this is used to diagnose the associated stations by theFBI ni t NetworkDi agnost i csSt r uct ure function block.

    Users can have the block automatically determine these diagnostic addresses, orthey can manually enter them at the block.

    The relevant settings for this are made at the structuregsNetworkAddr essDetect i onSet t i ngs, typesAddr essDetect i onSet t i ngs, which are transferred at inputaddressDetect i on at the block.

    Structure sAddressDetectionSettings

    Table 3-107

    Structure Parameters Data type Ptype

    1)M/O

    2)Initialvalue

    Description

    sAddressDetectionSettings

    boAutoDetectionOf

    NetworkAddresses

    BOOL IN M TRUE

    The networkdiagnosticaddresses aredeterminedautomatically

    7ARRAY [1..NUMBER_OF_NETWORKS] OF UDINT

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    23/43

    3 Functional mechanisms of this application

    3.3 FBInitNetworkDiagnosticsStructure

    Diagnosing station failures and module statesVersion V2.0, Entry ID: 53705461

    23

    CopyrightS

    iemensAG2013Allrightsreserved

    Structure Parameters Data type Ptype

    1)M/O

    2)Initialvalue

    Description

    sAddressDetectionSettings

    boManualNetworkAddress

    Presetting

    BOOL IN M FALSE

    TRUE:Network diagnosticaddresses must bemanually entered

    au32Network

    DiagnosticAddress

    ARRAY[1..NUMBER_...]

    OF UDINTIN O 0

    Array, whoseelements can bepre-assigned withthe requirednetwork diagnosticaddresses; the

    array size dependson the value of theconstant

    1)Parameter types:

    IN = input parameters, OUT = output parameters, IN/OUT = in/out parameters2)

    Parameter sort:

    M =mandatory parameter, O =optional parameter

    Automatically determin ing the network diagnostic addresses (defaul t setting)

    If the function block should automatically determine the network diagnosticaddresses, then variable boAutoDet ect i onOf Net workAddr esses should beset to the valueTRUE. This is realized automatically once when calling the block forthe first time after a SIMOTION control download. At the same time, variableboManual Net wor kAddr essPr eset t i ng is set to the value FALSE if thispreviously had the valueTRUE (also see Chapter 5.2).

    The system function_get Segment I dent i f i cat i on( ) , which is called in theblock, in this case supplies all of the network diagnostic addresses.

    Example

    HW Config of the SIMOTION control

    PROFIBUS network at PROFIBUS interface X136

    (diagnostics address16382

    ) PROFIBUS_Integrated

    (diagnostics address 16381)

    PROFINET network at PROFINET interface X150(diagnostics address 16349)

    ConstantNUMBER_OF_NETWORKS has a value greater than 3

    Variable boAutoDet ect i onOf Net workAddr esses has the valueTRUE

    Using the variablegboAct ual i sat i onOf NetworkDi agnost i csStr uct ure, the blockfunctionality can be re-initiated, if this is controlled to the valueTRUE

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    24/43

    3 Functional mechanisms of this application

    3.3 FBInitNetworkDiagnosticsStructure

    24Diagnosing station failures and module states

    Version V2.0, Entry ID: 53705461

    CopyrightS

    iemensAG2013Allrightsreserved

    The network diagnostic addresses are determined in the block using thesystem function_get Segment I dent i f i cat i on()

    The function block determines all of the network-associated addresses (i.e.diagnostic addresses and I/O addresses of the configured nodes) as well asthe actual states of the station and saves the data in the user structuregasMachi neNet wor k.

    This means that the user structure would look like this:

    gasMachi neNet wor k[ 1] contains the data for the PROFIBUS network(X136) with diagnostics address 16382

    gasMachi neNet wor k[ 2] contains the data for PROFIBUS_Integratedwith diagnostics address 16381

    gasMachi neNet wor k[ 3] contains the data for the PROFINET network(X1400) with the diagnostics address 16349

    Advantage:

    The block automatically determines the network diagnostic addresses; thismeans that the user does not need to know them in order to be able todiagnose the networks of his SIMOTION control.

    Contrary to a manual input at the block, the network diagnostic addressesdo not have to be changed, if these change in the HW configuration.

    Disadvantage:

    The user has no influence as to which networks of his SIMOTION controlare diagnosed. All of the networks are diagnosed, if the value of constantNUMBER_OF_NETWORKS is greater or equal to the configured number ofnetworks.

    Manually entering the network diagnostic addresses

    If the user is to manually enter the network diagnostic addresses at the functionblock, then variable boManual Net wor kAddr essPr eset t i ng must be set to thevalueTRUE. At the same time, variableboAutoDetect i onOf Net wor kAddr esses is set to the value FALSE if thispreviously had the valueTRUE (also see Chapter 5.4).

    The elements of the au32Net wor kDi agnost i cAddress array must then be pre-assigned with the network diagnostic addresses, whose stations are to bediagnosed by the function block.

    Example HW Config of the SIMOTION control

    PROFIBUS network at PROFIBUS interface X136(diagnostics address 16382)

    PROFIBUS_Integrated(diagnostics address 16381)

    PROFINET network at PROFINET interface X150(diagnostics address 16349)

    Variable boManual Net wor kAddr essPr eset t i ng has the valueTRUE

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    25/43

    3 Functional mechanisms of this application

    3.3 FBInitNetworkDiagnosticsStructure

    Diagnosing station failures and module statesVersion V2.0, Entry ID: 53705461

    25

    CopyrightS

    iemensAG2013Allrightsreserved

    The user only wishes to diagnose the PROFIBUS network at interface X136 aswell as the PROFINET network at PROFINET interface X150

    ConstantNUMBER_OF_NETWORKS has a value greater than 2

    The elements of the au32Net wor kDi agnost i cAddress array are pre-assigned as follows:

    au32Net wor kDi agnost i cAddress[ 1] = 16382

    au32Net wor kDi agnost i cAddress[ 2] = 16349

    au32Net wor kDi agnost i cAddress[ x] = 0

    Using the variablegboAct ual i sat i onOf NetworkDi agnost i csStr uct ure, the blockfunctionality can be re-initiated, if this is controlled to the valueTRUE

    The function block determines all of the network-associated addresses (i.e.diagnostic addresses and I/O addresses of the configured nodes) as well asthe actual states of the station and saves the data in the user structure

    gasMachi neNet wor k.

    This means that the user structure would look like this:

    gasMachi neNet wor k[ 1] contains the data for the PROFIBUS network(X136) with diagnostics address 16382

    gasMachi neNet wor k[ 2] contains the data for the PROFINET network(X1400) with the diagnostics address 16349

    gasMachi neNet wor k[ x] does not contain any data

    Advantage:

    The user can determine which and how many networks of his SIMOTIONcontrol should be diagnosed by entering the required network diagnostic

    addresses at the function block. Disadvantage:

    The user must know the corresponding network diagnostic addresses, inorder to diagnose the required networks of his SIMOTION control system.

    If the diagnostic addresses change in the HW configuration, then thesemust also be changed at the block.

    3.3.7 Transfer structure " counterArray"

    The gsCounterAr r ay structure, type sCounterAr r ayType is used to save all of

    the address information of the addresses, which were determined by the functionblock for the particular networks of the SIMOTION control system.This structure is transferred at the count er Ar r ay block input.

    The structure comprises the array asNet wor kI ndexAndStat i onNumber , whichcomprises a total of16384 array elements (from0 to 16383, whereby 16383represents the highest possible diagnostics address in the SIMOTION addressspace).

    Every element corresponds to a possible address (i.e. diagnostics or I/O address),which can occur in the HW configuration.

    The address information for the particular address is saved in the correspondingarray element.

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    26/43

    3 Functional mechanisms of this application

    3.3 FBInitNetworkDiagnosticsStructure

    26Diagnosing station failures and module states

    Version V2.0, Entry ID: 53705461

    CopyrightS

    iemensAG2013Allrightsreserved

    Structure sCounterArrayType

    Table 3-11

    Structure Parameters Data type P

    type

    1)M/O

    2)Initial

    value

    Description

    sCounterArrayType

    asNetworkIndexAndStationNumber

    ARRAY[0..16383] OFsAddressType

    OUT --- ---

    Array to save theadditional addressinformation of theparticular address

    Structure sAddressType

    Table 3-12

    Structure Parameters Data type Ptype

    1) M/O2) Initial

    valueDescription

    sAddressType

    sInput sCounterType OUT --- ---Structure forinput address

    sOutput sCounterType OUT --- ---Structure foroutput address

    sDiagnostic sCounterType OUT --- ---Structure fordiagnosticsaddress

    Structure sCounterType

    Table 3-13

    Structure Parameters Data type Ptype

    1)M/O

    2)Initialvalue

    Description

    sCounterType

    u8NetworkIndex

    USINT OUT --- 0

    Number of thenetwork in whichthe particularaddress wasdetermined

    u8StationNumber

    USINT OUT --- 0

    Number of thestation at which theparticular addresswas configured

    1)Parameter types:

    IN = input parameters, OUT = output parameters, IN/OUT = in/out parameters2)

    Parameter sort:

    M =mandatory parameter, O =optional parameter

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    27/43

    3 Functional mechanisms of this application

    3.3 FBInitNetworkDiagnosticsStructure

    Diagnosing station failures and module statesVersion V2.0, Entry ID: 53705461

    27

    CopyrightS

    iemensAG2013Allrightsreserved

    Example

    The following addresses are configured in the HW configuration:

    Diagnostics address 16361

    Input address 292

    Output address 1024

    The address information additionally determined by the block is saved in thetransfer structure count er Ar r ay in the following array elements:

    asNet wor kI ndexAndSt at i onNumber[ 16361]

    asNet wor kI ndexAndSt at i onNumber[ 292]

    asNet wor kI ndexAndSt at i onNumber[ 1024]

    As one address can occur several times (e.g. input address 292 and output theaddress 292), when saving the address information in the array elements, a

    differentiation is again made between input, output and diagnostics address.The address information also includes, in addition to the network number, thestation number in which the address was determined by the block.

    This information is subsequently used in the Per i pher al Faul t Task in order tofacilitate that the gasMachi neNet wor k user structure is quickly updated.

    3.3.8 Transfer structure "eventCounter"

    The structure gasEventCount er , which comprises an array, typesEvent CounterType, is only used at this block to reset the fault counter of all

    stations in the particular network, if the user re-initiates the block functionality.The structure is transferred at the event Count er block input.

    Structure sEventCounterType

    Table 3-148

    Structure Parameters Data type Ptype

    1)M/O

    2)Initialvalue

    Description

    sEventCounter

    Type

    asStation

    ARRAY[1..HI GHEST_...]

    OFsStationType

    OUT --- ---

    Array of thestructure, whichcontains faultcounters for allstations for eachnetwork

    1)Parameter types:

    IN = input parameters, OUT = output parameters, IN/OUT = in/out parameters2)

    Parameter sort:

    M =mandatory parameter, O =optional parameter

    8ARRAY [1..HI GHEST_STATI ON_ADDRESS_ AT_NETWORK] OF sStationType

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    28/43

    3 Functional mechanisms of this application

    3.3 FBInitNetworkDiagnosticsStructure

    28Diagnosing station failures and module states

    Version V2.0, Entry ID: 53705461

    CopyrightS

    iemensAG2013Allrightsreserved

    Structure sStationType

    Table 3-15

    Structure Parameters Data type P

    type

    1)M/O

    2)Initial

    value

    Description

    sStationType

    u16LastEventIndex

    UINT OUT --- 0

    Counter for ringbuffers of theparticular station;contains the indexof the element, inwhich a fault waslast entered

    u16NumberOfEvents

    UINT OUT --- 0

    Total number offaults still active atthe particularstation

    au16EventsOnModule

    ARRAY[1..HI GHEST_...]

    OF UINTOUT --- ---

    Total number offaults still active atthe particularmodule of station

    1)Parameter types:

    IN = input parameters, OUT = output parameters, IN/OUT = in/out parameters2)

    Parameter sort:

    M =mandatory parameter, O =optional parameter

    The structure gasEventCount er is updated at runtime in the

    Per i pheral Faul t Task. Here, what is known as the Task-Start-Information (TSI)is evaluated and corresponding to the fault counter of the stations with faults,incremented or decremented.

    This means that several faults of a station or several faults at a module can bedetected, and corresponding to the actual status of the station, adapted in thegasMachi neNet wor k user structure.

    Example

    Several faults occur simultaneously at a station, or one after the other.

    The fault counters of the particular station modules are increased by thenumber of faults, which have occurred at this module. In addition, the total

    number of faults is calculated that are active at the station. The actual status of the station is signaled in the user structure

    gasMachi neNet wor k as DI STURBED.

    Now, one of the active station faults is resolved. The fault counter of thecorresponding module is decremented by a value of1 and the total number offaults is adapted.

    The actual status of the station in the user structure is still signaled asDI STURBED.

    The station is only signaled in the user structure again as I N_OPERATI ONafterall station faults have been resolved.

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    29/43

    3 Functional mechanisms of this application

    3.4 FCMachinePeripheralFailureHandling

    Diagnosing station failures and module statesVersion V2.0, Entry ID: 53705461

    29

    CopyrightS

    iemensAG2013Allrightsreserved

    3.4 FCMachinePeripheralFailureHandling

    The FCMachi nePer i pheral Fai l ur eHandl i ng function is used to evaluate the

    Task-Start-Information (TSI) of the Per i pher al Faul t Task and to update theuser structure gasMachi neNet wor k.

    Coming as well as going faults are evaluated, and the fault information (associatedwith the network and associated with the station) is entered in the networkstructure.In addition, the fault counters of the stations with faults are incremented ordecremented in the gasEventCount er structure, which means that the actualstates of the stations are correspondingly adapted in the user structure.

    3.4.1 Functionality

    The function must be called in the Per i pher al Faul t Task.

    Coming as well as going faults are evaluated, and using the addressinformation saved in the gasCounterAr r ay structure, are saved in the userstructure, associated with the network and associated with the station.

    The actual status of the station is updated in the user structure, depending onwhether faults are active at the station or the station has actually failed.

    In addition to failure and return of a station, faults at their associated modulesare also detected (e.g. withdrawing/inserting, wire breakage/short-circuit etc.).

    The following Task-Start-Information (TSI) is evaluated depending on the fault:

    TSI#startTime Instant that the Per i pheral Faul t Task

    started TSI#interruptId signaled fault ID

    TSI#logDiagAdr diagnostic address of the station with a fault

    TSI#logBaseAdrIn input address of the station with fault

    TSI#logBaseAdrOut output address of the station with fault

    TSI#eventClass event class (depending onTSI #i nter r upt I d) as additionalfault information

    TSI#faultId fault ID (depending onTSI #i nter r upt I d andTSI #event Cl ass)as additional fault information

    TSI#details detailed information (depending on

    TSI #i nter r upt I d andTSI #event Cl ass)as additional fault information

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    30/43

    3 Functional mechanisms of this application

    3.4 FCMachinePeripheralFailureHandling

    30Diagnosing station failures and module states

    Version V2.0, Entry ID: 53705461

    CopyrightS

    iemensAG2013Allrightsreserved

    Overview of the fault IDs, which are evaluated

    Table 3-16

    TSI#interruptId Number Meaning

    _SC_PROCESS_INTERRUPT 200 Process interrupt has occurred on I/Omodule

    _SC_DIAGNOSTIC_INTERRUPT 201 Diagnostics alarm has occurred on I/Omodule

    _SC_STATION_DISCONNECTED 202 Station failure of an IO device / DP slave

    _SC_STATION_RECONNECTED 203 Station return of an IO device / DP slave

    _SC_IMAGE_UPDATE_FAILED 204 Faults when generating the process image

    _SC_IMAGE_UPDATE_OK 206 Generating the process image functionsagain

    _SC_ IO_MODULE_SYNCHRONIZED 214 Module has been synchronized

    _SC_ IO_MODULE_NOT_SYNCHRONIZED 215 Module is not synchronized_SC_PULL_PLUG_INTERRUPT 216 Withdrawing or inserting modules of an IO-

    Device / DP-Slave

    Note Additional information on the topic "Task-Start-Information (TSI)" is provided inthe SIMOTION SCOUT online help under the keyword "TSI".

    3.4.2 Schematic LAD representation

    Fig. 3-59

    9ARRAY [1..NUMBER_OF_NETWORKS] OF sNetworkType / sEventCounterType

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    31/43

    3 Functional mechanisms of this application

    3.4 FCMachinePeripheralFailureHandling

    Diagnosing station failures and module statesVersion V2.0, Entry ID: 53705461

    31

    CopyrightS

    iemensAG2013Allrightsreserved

    3.4.3 Parameters

    Table 3-1710

    Element Ptype

    1) Data type M/O2) Initial

    valueMeaning

    TSIStartTime IN DT MDT#0001-

    01-01-0:0:0

    Instant time thatPeri pher al Faul t Taskstarted

    TSILogDiagAddress

    IN DINT M 0Diagnostic address of thestation with a fault

    TSILogBaseAddressIn

    IN DINT M 0Input address of the station witha fault

    TSILogBaseAddressOut

    IN DINT M 0Output address of the stationwith a fault

    TSIInterruptId IN UDINT M 0 Signaled fault ID

    TSIEventClass IN UINT M 16#00_00Event class (depending on

    TSI I nt er r upt I d) asadditional fault information

    TSIFaultId IN UINT M 16#00_00

    Fault ID (depending onTSI I nt er r upt I d andTSI Event Cl ass) as additionalfault information

    TSIDetails IN DWORD M16#00_00_00_00

    Detailed information (dependingonTSI I nter r upt I d and

    TSI Event Cl ass) as additionalfault information

    counterArray IN/OUTsCounterArray

    Type M ---

    Transfer structure for the

    address information alreadydetermined

    network IN/OUTARRAY

    [1..NUMBER_...]OF sNetworkType

    M ---Structure to transfer the userstructure

    eventCounter IN/OUT

    ARRAY[1..NUMBER_...]

    OFsEventCounter

    Type

    M ---Structure to transfer the faultcounters of the stations

    1)Parameter types:

    IN = input parameters, OUT = output parameters, IN/OUT = in/out parameters2) Parameter sort:

    M =mandatory parameter, O =optional parameter

    10ARRAY [1..NUMBER_OF_NETWORKS] OF sNetworkType / sEventCounterType

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    32/43

    3 Functional mechanisms of this application

    3.4 FCMachinePeripheralFailureHandling

    32Diagnosing station failures and module states

    Version V2.0, Entry ID: 53705461

    CopyrightS

    iemensAG2013Allrightsreserved

    3.4.4 Fault messages

    Table 3-18

    Fault number [HEX] Meaning

    16#0000 No error

    16#1007 No network index and/or no station number was able to be foundin the address information for the address that was signaled ashaving a fault

    16#1008 The Faul t I d signaled fromPer i pheral Faul t Task isunknown

    16#1009 The diagnostics address signaled fromPer i pher al Faul t Taskis unknown

    16#1010 The logical address signaled fromPeri pher al Faul tTask isunknown

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    33/43

    4 Startup of the application

    4.1 Overview

    Diagnosing station failures and module statesVersion V2.0, Entry ID: 53705461

    33

    CopyrightS

    iemensAG2013Allrightsreserved

    4 Startup of the application

    4.1 Overview

    The zip archive 53705461_SI MOTI ON_Di agnost i cs_V2_0. zi p suppliedwith this application example includes the ST sources required for diagnostics.

    The ST source f Machi neNet wor kDi agnost i cs contains the function blocksFBGetStat eOf Al l Stat i onsAt Network andFBI ni t NetworkDi agnost i csSt r uctur e as well as theFCMachi nePer i pheral Fai l ur eHandl i ng function.

    The ST source pMachi neNet wor kDi agnost i cs contains the programs forthe Backgr oundTask as well as the Per i pher al Faul t Task, in which thefunction blocks as well as the function are called.

    The programpMachi neNet wor kDi agnost i csBackgr oundTask should be

    preferably integrated into the Backgr oundTask.The programpMachi neNet wor kDi agnost i csPer i pheral Faul t Taskmust be integrated into the Per i pher al Faul t Task.

    4.2 Integrating ST sources

    The ST sources f Machi neNet wor kDi agnost i cs as well aspMachi neNet wor kDi agnost i cs can be integrated in a new as well as in anexisting project.

    Table 4-1

    No. Action

    1. Extract the ZIP archive supplied.

    2. Open the project in which the ST sources should be integrated.

    3. In the project tree, open the properties of the required SIMOTION control and selectthe PROGRAMS subfolder.

    The shortcut menu opens with a right-click. Here, select the option "Importexternal source > ST source file" .

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    34/43

    4 Startup of the application

    4.3 Linking in the programs

    34Diagnosing station failures and module states

    Version V2.0, Entry ID: 53705461

    CopyrightS

    iemensAG2013Allrightsreserved

    No. Action

    4. Select the ST sources f Machi neNet workDi agnost i cs and

    pMachi neNet wor kDi agnost i cs (keep the Ct r l key pressed), and click on the"Open" button.

    5. Start the import by pressing the "OK" button.No other settings must be made.

    6. Save and compile the project.

    4.3 Linking in the programs

    After the ST sources have been imported, the programs must be linked into thecorresponding tasks.

    Table 4-2

    No. Action

    1. In the project tree, open the Execut i on syst emof the SIMOTION control system.

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    35/43

    4 Startup of the application

    4.3 Linking in the programs

    Diagnosing station failures and module statesVersion V2.0, Entry ID: 53705461

    35

    CopyrightS

    iemensAG2013Allrightsreserved

    No. Action

    2. Select the Backgr oundTask and link in the

    pMachi neNet wor kDi agnost i csBackgroundTask program using the ">>" button into the task.

    Note

    Proceed in the same way for thepMachi neNet wor kDi agnost i csPer i pheral Faul tTask program.Note that the program must be linked into the Per i pheral Faul t Task!

    3. Save and compile the project.

    4. Load the modified settings into the SIMOTION controller.

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    36/43

    5 Operating the application

    5.1 Adapting the value of the global constants

    36Diagnosing station failures and module states

    Version V2.0, Entry ID: 53705461

    CopyrightS

    iemensAG2013Allrightsreserved

    5 Operating the application

    5.1 Adapting the value of the global constants

    Global constants are used in the application example, which the user can adapt tofurther optimize the diagnostic functions.

    Table 5-1

    No. Action

    5. The global constants are located in the ST sourcef Machi neNet wor kDi agnost i cs and default values are assigned to them (seeChapter 2.2: Description of the core functionality). Adapt the values correspondingto your configuration.

    6. Save and compile the project.

    7. Load the modified settings into the SIMOTION controller.

    Note The values of the constants should always be selected corresponding to theSIMOTION configuration, as otherwise, after initiating the diagnostic functionalityonce, more cycle time is required in the Backgr oundTask than is absolutelynecessary.

    Note If the variables of the diagnostic functionality are to be accessed from an HMI(i.e. variables of the user structure gasMachi neNet wor k), then it must beensured that all HMI-relevant variables lie below the 64kByte address limit forHMI access operations.

    If the 64kByte address limit is exceeded, when compiling, the compiler outputs

    an alarm indicating that from the user structure gasMachi neNet wor k onwards,it is no longer possible for the HMI to access variables:

    When using the standard values of the constants, for the user structuregasMachi neNet wor k a size of approx. 1125kByte is obtained; as aconsequence, the data contained in it can no longer be accessed from the HMI.

    The size of the user structure can be correspondingly reduced by adapting thevalues.

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    37/43

    5 Operating the application

    5.2 Automatic execution of the diagnostic functionality

    Diagnosing station failures and module statesVersion V2.0, Entry ID: 53705461

    37

    CopyrightS

    iemensAG2013Allrightsreserved

    Note The actual size of the user structure is displayed in thei 32Si zeOf GasMachi neNet wor k variable. This is written once to the

    pMachi neNet wor kDi agnost i csBackgr oundTask program after theSIMOTION control has been downloaded.

    If the size of the user structure cannot be reduced as a result of the SIMOTIONconfiguration to the address limit of64kByte by adapting the values of theconstants, then the required files must be copied over into another structure,which the HMI can then access.

    5.2 Automatic execution of the diagnostic functionality

    To automatically execute the diagnostic functionality, after downloading the ST

    sources into the SIMOTION control, no settings are required.As soon as the control is switched into operating mode "RUN" , all of the networksconfigured at the SIMOTION control are automatically diagnosed, and thediagnostics data is saved in the gasMachi neNet wor k user structure.

    If, in the meantime, the manual input of network diagnostic addresses function hasbeen used (see Chapter 5.4), then using the following setting, you can switch backto automatically determining the diagnostics data.

    Table 5-2

    No. Action

    8. To do this, in thePROGRAMS folder of the SIMOTION control, select the ST source

    pMachi neNet wor kDi agnost i cs. The content of the ST source is displayed inthe symbol browser. There, open the gsNetworkAddressDetectionSettings globalstructure.

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    38/43

    5 Operating the application

    5.2 Automatic execution of the diagnostic functionality

    38Diagnosing station failures and module states

    Version V2.0, Entry ID: 53705461

    CopyrightS

    iemensAG2013Allrightsreserved

    No. Action

    9. Using the "Control" button, change the variable

    boAutoDetect i onOf NetworkAddr esses to the value "TRUE".

    Note

    The variable boManual Net wor kAddr essPreset t i ngs is automatically set to thevalue "FALSE" .Network diagnostic addresses possibly entered in arrayau32Net wor kDi agnost i cAddress are ignored with this setting of the functionblockFBI ni tNetworkDi agnost i cSt r uctur e.

    10. Using the "Control" button, change the variablegboAct ual i sat i onOf NetworkDi agnost i csSt r uctur e to the value "TRUE".

    Note

    After executing the function block FBI ni t NetworkDi agnost i cSt r uct ure theglobal variable is automatically reset to the value "FALSE" .

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    39/43

    5 Operating the application

    5.3 Manually initiating the diagnostics functionality

    Diagnosing station failures and module statesVersion V2.0, Entry ID: 53705461

    39

    CopyrightS

    iemensAG2013Allrightsreserved

    5.3 Manually initiating the diagnostics functionality

    If required, the diagnostics functionality can also be manually initiated by the user.

    Table 5-3

    No. Action

    11. To do this, in thePROGRAMS folder of the SIMOTION control, select the ST sourcepMachi neNet wor kDi agnost i cs. The content of the ST source is displayed inthe symbol browser.

    12. Using the "Control" button, change the variablegboAct ual i sat i onOf NetworkDi agnost i csSt r uctur e to the value "TRUE".

    Note

    After executing the function block FBI ni t NetworkDi agnost i cSt r uct ure theglobal variable is automatically reset to the value "FALSE" .

    13. The function blocks FBI ni tNetworkDi agnost i cSt r uct ur eandFBGetStat eOf Al l Stat i onsAt Network are executed again.All configured stations as well as the actual state are determined and saved in the

    user structure gasMachi neNet wor k.

    Note Each time after the diagnostics functionality has been manually initiated all of thedata existing at this time in the user structure are deleted, and replaced by thenew data. Faults already entered at the stations or their associated modules aretherefore not kept!

    5.4 Manually entering the network diagnost ic addresses

    When required (see Chapter 3.3.6:Transfer structure "addressDetection") thediagnostic addresses of the networks, which are to be diagnosed, can be manuallyentered by the user at the FBI ni t NetworkDi agnost i cSt r uctur e functionblock.

    Table 5-4

    No. Action

    14. Open the HW configuration of the SIMOTION control, whose networks you wish todiagnose.

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    40/43

    5 Operating the application

    5.4 Manually entering the network diagnostic addresses

    40Diagnosing station failures and module states

    Version V2.0, Entry ID: 53705461

    CopyrightS

    iemensAG2013Allrightsreserved

    No. Action

    15. Select the SIMOTION control. In the detailed window at the lower edge of the

    screen, you obtain an overview of the interfaces as well as their diagnosticaddresses.

    Note

    Only the diagnostic addresses of the interfaces (not the ports!) can be transferredto the function block.If incorrect diagnostic addresses are transferred to the block, then no diagnosticsdata can be determined for it.

    16. Change into SIMOTION SCOUT and in the folderPROGRAMS of the SIMOTIONcontrol, select the ST source pMachi neNet wor kDi agnost i cs.

    The content of the ST source is displayed in the symbol browser.

    17. In the symbol browser, open the global structuregsNetworkAddr essDetect i onSet t i ngs as well as arrayau32Net wor kDi agnost i cAddress contained in it.

    Note

    The size of the array depends on the value of the constantNUMBER_OF_NETWORKSin the ST source f Machi neNet workDi agnost i cs .

    As a consequence, only this maximum number of network diagnostic addresses canbe specified at the block.

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    41/43

    5 Operating the application

    5.4 Manually entering the network diagnostic addresses

    Diagnosing station failures and module statesVersion V2.0, Entry ID: 53705461

    41

    CopyrightS

    iemensAG2013Allrightsreserved

    No. Action

    18. Using the "Control" button, change the variable

    boManual Net wor kAddr essPr eset t i ng to the value "TRUE".

    Note

    The variable boAutoDet ect i onOf Net workAddresses is automatically set to thevalue "FALSE" .

    19. Then enter the required network diagnostic addresses in the elements of theau32Net wor kDi agnost i cAddress array, and accept these also using the"control" button.

    Note

    It is not absolutely necessary that all array elements are assigned a diagnosticsaddress. For elements with the value "0", the block does not determine anydiagnostics data; as a consequence, the corresponding elements of the userstructure contain their standard values.

    However, for performance reasons, it makes more sense in such a case toappropriately adapt the value of the NUMBER_OF_NETWORKS constant.

    20. Using the "Control" button, change the variablegboAct ual i sat i onOf NetworkDi agnost i csSt r uctur e to the value "TRUE",to initiate the diagnostics functionality for the selected networks.

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    42/43

    5 Operating the application

    5.4 Manually entering the network diagnostic addresses

    42Diagnosing station failures and module states

    Version V2.0, Entry ID: 53705461

    CopyrightS

    iemensAG2013Allrightsreserved

    No. Action

    21. All of the stations configured in the selected networks as well as their actual state

    are determined, and saved in the gasMachi neNet wor k user structure.The sequence of the diagnostic addresses transferred at the block corresponds tothe sequence of the data that were saved in the user structure.

    For instance, if network diagnostic address 16349 is transferred to array elementau32Net wor kDi agnost i cAddr ess[ 2] then after executing the function blockFBI ni tNetworkDi agnost i cSt r uct ure, the determined diagnostics data forthis network are also located in array elementgasMachi neNet wor k[ 2] of theuser structure.

  • 7/27/2019 53705461 SIMOTION Diagnostics V2 0 En

    43/43

    6 References

    6.1 Internet links

    CopyrightS

    iemensAG2013Allrightsreserved

    6 References

    6.1 Internet links

    This list does not purport to be complete and merely reflects a selection of suitableinformation.

    Table 6-1

    Topic Title

    \1\ Reference to thearticle

    http://support.automation.siemens.com/WW/view/en/53705461

    \2\ Siemens IndustryOnline Support

    http://support.automation.siemens.com

    7 ContactsSiemens AG

    Industry SectorI DT MC PMA APCFrauenauracher Str. 8091056 Erlangen, GermanyE-mail: [email protected]

    8 HistoryTable 8-1Version Date Change

    V1.0 06/2011 First edition

    V2.0 06/2013 Revised version,ST sources and documentation have been revised

    http://support.automation.siemens.com/WW/view/en/53705461http://support.automation.siemens.com/WW/view/en/53705461http://support.automation.siemens.com/http://support.automation.siemens.com/mailto:[email protected]:[email protected]:[email protected]://support.automation.siemens.com/http://support.automation.siemens.com/WW/view/en/53705461