Vous êtes sur la page 1sur 43

SIMOTION Diagnosing station failures and module states

SIMOTION Application June 2013

Applications & Tools


Answers for industry.

Siemens Industry Online Support This article is taken from the Siemens Industry Online Support. The following link takes 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 the realization of the automation task predominantly. Please take into account furthermore that corresponding protective measures have to be taken up in the context of Industrial Security when connecting your equipment to other parts of the plant, the enterprise network or the Internet. Further information can be found under the Item-ID 50203404. http://support.automation.siemens.com/WW/view/en/50203404

Copyright

Siemens AG 2013 All rights reserved

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

Task

1 2 3 4 5 6 7 8

Solution Functional mechanisms of this application Startup of the application Operating the application

SIMOTION Diagnosing station failures and module states

References

Contacts
Siemens AG 2013 All rights reserved

History

Copyright

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

Warranty and liability

Warranty and liability


Note The Application Examples are not binding and do not claim to be complete regarding the circuits shown, equipping and any eventuality. The Application Examples do not represent customer-specific solutions. They are only intended to provide support for typical applications. You are responsible for ensuring that the described products are used correctly. These application examples do not relieve you of the responsibility to use safe practices in application, installation, operation and maintenance. When using these Application Examples, you recognize that we cannot be made liable for any damage/claims beyond the liability clause described. We reserve the right to make changes to these Application Examples at any time without prior notice. If there are any deviations between the recommendations provided in these application examples and other Siemens publications e.g. Catalogs the contents 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 of the examples, information, programs, engineering and performance data etc., described in this Application Example shall be excluded. Such an exclusion shall not apply in the case of mandatory liability, e.g. under the German Product Liability Act (Produkthaftungsgesetz), in case of intent, gross negligence, or injury of life, body or health, guarantee for the quality of a product, fraudulent concealment of a deficiency or breach of a condition which goes to the root of the contract (wesentliche Vertragspflichten). The damages for a breach of a substantial contractual obligation are, however, limited to the foreseeable damage, typical for the 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 of proof to your detriment. Any form of duplication or distribution of these Application Examples or excerpts hereof is prohibited without the expressed consent of Siemens Industry Sector.

Copyright

Siemens AG 2013 All rights reserved

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

Table of contents

Table of contents
Warranty and liability ............................................................................................... 4 1 Task................................................................................................................. 6 1.1 2 Overview ........................................................................................... 6

Solution........................................................................................................... 7 2.1 2.2 2.3 Overview of the overall solution ......................................................... 7 Description of the core functionality.................................................... 8 Hardware and software components used ....................................... 10

Functional mechanisms of this application ................................................ 11 3.1 3.2 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.3 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.4 3.4.1 3.4.2 3.4.3 3.4.4 User structure "gasMachineNetwork" ............................................... 11 FBGetStateOfAllStationsAtNetwork ................................................. 16 Functionality .................................................................................... 16 Schematic LAD representation......................................................... 16 Parameters...................................................................................... 17 Timing diagram ................................................................................ 17 Fault messages ............................................................................... 18 FBInitNetworkDiagnosticsStructure .................................................. 19 Functionality .................................................................................... 19 Schematic LAD representation......................................................... 20 Parameters...................................................................................... 20 Timing diagram ................................................................................ 21 Fault messages ............................................................................... 22 Transfer structure "addressDetection" .............................................. 22 Transfer structure "counterArray" ..................................................... 25 Transfer structure "eventCounter" .................................................... 27 FCMachinePeripheralFailureHandling .............................................. 29 Functionality .................................................................................... 29 Schematic LAD representation......................................................... 30 Parameters...................................................................................... 31 Fault messages ............................................................................... 32

Copyright

Siemens AG 2013 All rights reserved

Startup of the application............................................................................. 33 4.1 4.2 4.3 Overview ......................................................................................... 33 Integrating ST sources ..................................................................... 33 Linking in the programs.................................................................... 34

Operating the application............................................................................. 36 5.1 5.2 5.3 5.4 Adapting the value of the global constants ....................................... 36 Automatic execution of the diagnostic functionality ........................... 37 Manually initiating the diagnostics functionality................................. 39 Manually entering the network diagnostic addresses ........................ 39

References .................................................................................................... 43 6.1 Internet links .................................................................................... 43

7 8

Contacts........................................................................................................ 43 History .......................................................................................................... 43

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

1 Task 1.1 Overview

1
1.1

Task
Overview
The following figure provides an overview of the automation task.
Fig. 1-1

Overview of the automation task

PROFINET PROFIBUS SIMOTION

I/Os
Siemens AG 2013 All rights reserved

Drive

I-Device

I/Os

Drive

I-Slave

Copyright

Description of the automation task The IO devices connected to a SIMOTION control should be monitored for failure and module state changes. This should be implemented during the SIMOTION application runtime. The status data for PROFINET IO as well as for the PROFIBUS DP nodes should be 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 should see there for the associated configured node whether an error is present at one or several modules or whether the node has failed. In order to track the error over time, the error information as well as a certain number of errors should also be stored in the structure associated with the station.

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

2 Solution 2.1 Overview of the overall solution

2
2.1

Solution
Overview of the overall solution
The following schematic diagram shows the most important components of the solution:
Fig. 2-1

Schematic diagram

PROFINET PROFIBUS
ET200S IM 151 DP HF

SINAMICS G120 CU240E-2 DP SIMOTION D435-2 DP/PN (+ CBE30-2)

Copyright

Siemens AG 2013 All rights reserved

SINAMICS S120 CU310-2 PN

ET200S IM151-3 PN HF

SIMATIC CPU317-2 PN/DP

Advantages This application described here offers you the following advantages: High-performance diagnostics of PROFINET IO devices as well as PROFIBUS DP slaves belonging to a SIMOTION control to the module level The actual states of the stations are determined once during the runtime of the SIMOTION application Diagnostic data is stored in a user structure The user structure is automatically updated using fault information from the PeripheralFaultTask It is also possible to access the diagnostics data from HMIs

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

2 Solution 2.2 Description of the core functionality

2.2

Description 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 a SIMOTION control system and configured in the hardware configuration are diagnosed (incl. I-Devices / I-Slaves). During the application runtime the actual state of all configured stations (as well as their associated modules) is determined once and saved in a user structure. The structure is subsequently updated by evaluating what is known as the "Task-StartInformation (TSI)" of the PeripheralFaultTask and copying the fault information to the corresponding location in the user structure. The ST sources required for the diagnostics are included in the ZIP archive 53705461_SIMOTION_Diagnostics_V2_0.zip that is supplied.

System functions used The following system functions provided by SIMOTION are used in the application example:
Siemens AG 2013 All rights reserved

_getSegmentIdentification() All configured bus segments are determined. _getStateOfAllDpStations() The status of all configured devices is determined. _getNextLogAddress() All configured logical addresses of a bus segment are determined.

Copyright

Constants used Global constants, which the user can adapt to further optimize diagnostics are used in the application example. The following constants are located in the ST source fMachineNetworkDiagnostics: NUMBER_OF_NETWORKS Number 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 with a station address less or equal to this constant are diagnosed. (default: 128, maximum: 128) HIGHEST_NUMBER_OF_MODULES_PER_STATION Highest number of modules ( I/O addresses) for each station for all configured bus segments, whose status is to be determined. For all stations with a number of modules ( I/O addresses) smaller than or equal to this constant the module states are diagnosed. (default: 64, maximum: 255) NUMBER_OF_STORED_EVENTS_PER_STATION Number of events that should be stored for each station. (default: 8, maximum 255)

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

2 Solution 2.2 Description of the core functionality Overview of the sources/blocks


Table 2-1 Sources pMachineNetworkDiagnostics fMachineNetworkDiagnostics Function/function block Programming language ST ST Property No No Must be adapted to the application No Know-how protection

FBGetStateOfAllStationsAtNetwork

This function block determines the actual states of all configured stations. This function block is used to initialize the diagnostics structure. This function is used to evaluate the task start information of the PeripheralFaultTask.

FBInitNetworkDiagnosticsStructure

No

FCMachinePeripheralFailureHandling

No

Copyright

Siemens AG 2013 All rights reserved

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

2 Solution 2.3 Hardware and software components used

2.3

Hardware and software components used


The application example has been created with the following components:

Hardware components
Table 2-2 Component SIMOTION D435-2 DP/PN SIMATIC 317-2 PN/DP (I-Device) ET200S HF (PROFINET) SINAMICS S120 CU310-2 PN ET200S HF (PROFIBUS) SINAMICS G120 CU240E-2 DP Qty. 1 1 1 1 1 1 Order number 6AU1 435-2AD00-0AA0 6ES7 317-2EK14-0AB0 6ES7 151-3BA23-0AB0 6SL3 040-1LA01-0AA0 6ES7 151-1BA00-0AB0 6SL3 244-0BB12-1PA1 Note V 4.3 SP1 HF12 V3.2.7 V 7.0.1 V 4.6 HF3 V1.1.3 V4.6 HF3

Standard software components


Table 2-3
Siemens AG 2013 All rights reserved

Component STEP7 SIMOTION SCOUT SSP SINAMICS SSP SINAMICS G120

Qty. 1 1 1 1

Order number 6ES7 810-4CC10-0YA7 6AU1 810-1BA43-1XA0 ----V5.5 SP3

Note V4.3 SP1 HF12 V4.6 (Download) V4.6 (Download)

Sample files and projects The list below contains all the files and projects used in this example.
Table 2-4 Component 53705461_SIMOTION_Diagnostics_V2_0_en.pdf 53705461_SIMOTION_Diagnostics_V2_0.zip Note This document ZIP archive with the ST sources required for the diagnostics

Copyright

10

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

3 Functional mechanisms of this application 3.1 User structure "gasMachineNetwork"

3
3.1

Functional mechanisms of this application


User structure "gasMachineNetwork"
The user structure gasMachineNetwork comprises an array, with the structure sNetworkType (see Table 3-1) with a dynamic number of elements for the individual networks of a SIMOTION control system. The size of the array is dependent on the value of the NUMBER_OF_NETWORKS constant. All of the data relevant for the user are saved in this structure, which are required to diagnose the networks of a SIMOTION control as well as its stations.

Structure sNetworkType
Table 3-11 Structure Parameters Data type P type1) M/O2) Initial value Description

sNetwork Type eTypeOf Network u8NumberOf StationsAt Network u8NumberOf Disturbed Stations u8Last Disturbed Station Enum Network Type USINT OUT --UNKNOWN Displays the network type Number of configured stations in the network Number of currently faulty stations in the network Display of the last faulty station in the network Array of the structure with a dynamic number of elements for the stations in the network; the array size depends on the value of the constant. (see Table 3-2)

Siemens AG 2013 All rights reserved

OUT

---

USINT

OUT

---

Copyright

USINT

OUT

---

asStation

ARRAY [1.HIGHEST_...] OF sStateOf DevicesAt NetworkType

OUT

---

---

1)

2)

Parameter types: IN = input parameters, OUT = output parameters, IN/OUT = in/out parameters Parameter sort: M = mandatory parameter, O = optional parameter

ARRAY [1.HIGHEST_STATION_ADDRESS_AT_NETWORK] OF sStateOfDevicesAtNetworkType

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

1 1

3 Functional mechanisms of this application 3.1 User structure "gasMachineNetwork" Structure sStateOfDevicesAtNetworkType
Table 3-22 Structure Parameters Data type P type1) M/O2) Initial value Description

sStateOf DevicesAt Network Type i32 Diagnostic Address eActualState DINT Enum StateOf DpStation OUT --0 NO_VALID _STATE Diagnostic address of the station Current state of the station Fault, which was signaled for this station in the PeripheralFaultTask Event class (depending on u32InterruptId) as additional fault information Fault identification (depending on u32InterruptId and b16EventClass) as additional fault information Detailed information (depending on u32InterruptId and b16EventClass) on the prevailing fault Number of currently faulty modules ( I/O addresses) of the station Number of the last faulty module of the station Structure, which is used to save the faults at the station (see Table 3-3)

OUT

---

u32 InterruptId

UDINT

OUT

---

Siemens AG 2013 All rights reserved

b16Event Class

WORD

OUT

---

16#00_00

b16FaultId

WORD

OUT

---

16#00_00

Copyright

b32Details

DWORD

OUT

---

16#00_00 _00_00

u8NumberOf Disturbed Modules u8Last Disturbed Module sEvent History

USINT

OUT

---

USINT sEvent History Type

OUT

---

OUT

---

---

ARRAY [1..HIGHEST_NUMBER_OF_MODULES_PER_STATION] OF sModuleType

12

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

3 Functional mechanisms of this application 3.1 User structure "gasMachineNetwork"

Structure

Parameters

Data type

P type1)

M/O2)

Initial value

Description

sStateOf DevicesAt Network Type Array of the structure with a dynamic number of elements for the modules ( I/O addresses) of the station; array size depends on the value of the constant (see Table 3-5)

asModule

ARRAY [1..HIGHEST_...] OF sModuleType

OUT

---

---

1)

2) Siemens AG 2013 All rights reserved

Parameter types: IN = input parameters, OUT = output parameters, IN/OUT = in/out parameters Parameter sort: M = mandatory parameter, O = optional parameter

Structure sEventHistoryType
Table 3-33 Structure Parameters Data type P type1) M/O2) Initial value Description

Copyright

sEvent HistoryType u16Last EventIndex Pointer to the last fault entry in the array asEvent, that serves as ring buffer Array of the structure with a dynamic number of elements to save station faults; array size depends on the value of the constant (see Table 3-4)

UINT

OUT

---

asEvent

ARRAY [1..NUMBER_...] OF sEventType

OUT

---

---

1)

2)

Parameter types: IN = input parameters, OUT = output parameters, IN/OUT = in/out parameters Parameter sort: M = mandatory parameter, O = optional parameter

ARRAY [1..NUMBER_OF_STORED_EVENTS_PER_STATION] OF sEventType

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

1 3

3 Functional mechanisms of this application 3.1 User structure "gasMachineNetwork" Structure sEventType
Table 3-4 Structure Parameters Data type P type1) M/O2) Initial value Description

sEvent Type Instant time that PeripheralFaultTask is called (i.e. the instant in time of the coming/going fault) Fault, which was signaled for this station in the PeripheralFaultTask Event class (depending on u32InterruptId) as additional fault information Fault identification (depending on u32InterruptId and b16EventClass) as additional fault information Detailed information (depending on u32InterruptId and b16EventClass) on the prevailing fault Number of modules at which the fault has occurred

dtEvent Occurred

DT

OUT

---

DT#000101-010:0:0

u32 InterruptId

UDINT

OUT

---

Siemens AG 2013 All rights reserved

b16Event Class

WORD

OUT

---

16#00_00

b16FaultId

WORD

OUT

---

16#00_00

Copyright

b32Details

DWORD

OUT

---

16#00_00 _00_00

u8Disturbed Module
1)

USINT

OUT

---

2)

Parameter types: IN = input parameters, OUT = output parameters, IN/OUT = in/out parameters Parameter sort: M = mandatory parameter, O = optional parameter

14

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

3 Functional mechanisms of this application 3.1 User structure "gasMachineNetwork" Structure sModuleType
Table 3-5 Structure Parameters Data type P type1) M/O2) Initial value Description

sModule Type i32Logical Address eAddress Type u32Length OfAddress DINT EnumModule Type UDINT OUT OUT OUT ------0 NO_VALID _TYPE 0 Logical address of the module Type of logical address Length of the module address in bytes Fault, which was signaled for this module in the PeripheralFaultTask Event class (depending on u32InterruptId) as additional fault information Fault identification (depending on u32InterruptId and b16EventClass) as additional fault information Detailed information (depending on u32InterruptId and b16EventClass) on the prevailing fault

u32 InterruptId

UDINT

OUT

---

Siemens AG 2013 All rights reserved

b16Event Class

WORD

OUT

---

16#00_00

b16FaultId

WORD

OUT

---

16#00_00

Copyright

b32Details

DWORD

OUT

---

16#00_00 _00_00

1)

2)

Parameter types: IN = input parameters, OUT = output parameters, IN/OUT = in/out parameters Parameter sort: M = mandatory parameter, O = optional parameter

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

1 5

3 Functional mechanisms of this application 3.2 FBGetStateOfAllStationsAtNetwork

3.2

FBGetStateOfAllStationsAtNetwork
The function block FBGetStateOfAllStationsAtNetwork 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 execute input. The block is called by specifying the diagnostics address (diagAddressOfNetwork) of the corresponding network.

Siemens AG 2013 All rights reserved

The states of all stations configured on this network are read out. Internally, the system function _getStateOfAllDpStations() 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 errorId that is also output. The various error IDs can be reviewed in the online help for SIMOTION for the _getStateOfAllDpStations() system function. The done output indicates that the function block has been successfully executed. The results of the function block are only located in the user structure gasMachineNetwork for done = TRUE.

Copyright

3.2.2

Schematic LAD representation


Fig. 3-14

ARRAY [1..HIGHEST_STATION_ADDRESS_AT_NETWORK] OF sStateOfDevicesAtNetworkType

16

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

3 Functional mechanisms of this application 3.2 FBGetStateOfAllStationsAtNetwork

3.2.3
Table 3-65 Element

Parameters

P type1)

Data type

M/O2)

Initial value FALSE 0

Meaning TRUE: Start of the functionality Diagnostics address of the network to be diagnosed Transfer structure for the status of the stations and their modules (also see Table 3-2) Transfer structure for the number of stations in the network Job being processed Processing completed TRUE: Error when calling the function Error code

execute diagAddressOf Network

IN IN

BOOL UDINT ARRAY [1..HIGHEST_...] OF sStateOfDevices AtNetworkType INT BOOL BOOL BOOL

M M

stateOfStations

IN/OUT

numberOf Stations done busy


Siemens AG 2013 All rights reserved

IN/OUT OUT OUT OUT

M -

0 FALSE FALSE FALSE 16#00_00 _00_00

error

errorId
1)

OUT

DWORD

2)

Parameter types: IN = input parameters, OUT = output parameters, IN/OUT = in/out parameters Parameter sort: M = mandatory parameter, O = optional parameter

Copyright

3.2.4

Timing diagram
Fig. 3-2

ARRAY [1..HIGHEST_STATION_ADDRESS_AT_NETWORK] OF sStateOfDevicesAtNetworkType

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

1 7

3 Functional mechanisms of this application 3.2 FBGetStateOfAllStationsAtNetwork Block processing without error The block is started with a rising edge at the input execute. When starting, the block indicates that it is being actively processed with busy = TRUE. When the block processing has been completed, output busy = FALSE. At the same time, the block signals using done = TRUE that the block functionality has been successfully completed. If execute is set again from FALSE to TRUE before the function is completed, the current processing is canceled and the block again starts to execute the function. All outputs are initialized.

Block processing with error The block is started with a rising edge at execute. When starting, the block indicates that it is being actively processed with busy = TRUE.
Siemens AG 2013 All rights reserved

An error in the block processing is then detected. This error is indicated by error = TRUE and a corresponding ID is displayed at the errorID output. The block can be restarted with execute = TRUE.

3.2.5

Fault messages
Table 3-7 Fault number [HEX] 16#0000 16#1005 16#1006 No error Internal error: The internal step bit memory of the FB has an invalid value Internal error: The runtime of the _getStateOfAllDpStations() function has exceeded the maximum time of 20 seconds See the online help for the system function _getStateOfAllDpStations() Meaning

Copyright

16#FFFF80xx

18

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

3 Functional mechanisms of this application 3.3 FBInitNetworkDiagnosticsStructure

3.3

FBInitNetworkDiagnosticsStructure
The function block FBInitNetworkDiagnosticsStructure is used to initialize the user structure gasMachineNetwork. Using the system function _getSegmentIdentification() networks configured for a SIMOTION control and their associated diagnostic addresses are determined once. Users can also specify diagnostic addresses. For each determined network, all of the associated addresses (i.e. diagnostic addresses and I/O addresses) are determined using the _getNextLogAddress() system function. The address information is saved associated with the network and associated with the station in the user structure gasMachineNetwork as well as associated with the address in the gsCounterArray structure. This subsequently guarantees that the data are quickly updated in the gasMachineNetwork user structure. Using the FBGetStateOfAllStationsAtNetwork function block, the states of the stations in the network are subsequently determined, and also saved in the gasMachineNetwork user structure. The function block has now been executed and when required, can be re-initiated by the user.

Siemens AG 2013 All rights reserved

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 execute input. Using the addressDetection input of the function block, the user can define as to whether the diagnostic addresses for the networks configured for the SIMOTION 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 that valid 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 errorId output. Internally, the system functions _getSegmentIdentification(), _getNextLogAddress() and _getStateOfAllDpStations() are called in the form of the FBGetStateOfAllStationsAtNetwork 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 the gsCounterArray structure. This structure comprises an array with a size of [0..16383].

Copyright

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

1 9

3 Functional mechanisms of this application 3.3 FBInitNetworkDiagnosticsStructure In this case, for example, the information of address 256 is saved in the array element 256, the information of address 16383 in the array element 16383. This procedure guarantees that data in the gasMachineNetwork user structure are quickly updated. The first address of a station to be newly determined is saved as diagnostics address, and all other addresses as "module addresses" of the station in the gasMachineNetwork user structure.

3.3.2

Schematic LAD representation


Fig. 3-36

Siemens AG 2013 All rights reserved

3.3.3
Table 3-8 Element execute address Detection

Parameters

Copyright

P type1) IN

Data type BOOL sAddress Detection Type sCounter ArrayType ARRAY [1..NUMBER_...] OF sNetwork Type ARRAY [1..NUMBER_...] OF sEvent Counter Type

M/O2) M

Initial value FALSE

Meaning TRUE: Start of the functionality Transfer structure to define the automatic determination of the network diagnostic addresses for manual input (see Chapter 3.3.6) Transfer structure to save all of the address information (see Chapter 3.3.7) Transfer structure to save the determined data in the user structure (see also Table 3-1) Transfer structure to clear the error account of the stations when the block functionality is re-initiated (see Chapter 3.3.8)

IN

counterArray

IN/OUT

network

IN/OUT

eventCounter

IN/OUT

ARRAY [1..NUMBER_OF_NETWORKS] OF sNetworkType / sEventCounterType

20

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

3 Functional mechanisms of this application 3.3 FBInitNetworkDiagnosticsStructure


Element P type1) OUT Data type M/O2) Initial value FALSE Meaning TRUE: Function block being processed TRUE: Function block successfully completed TRUE: Function block cancelled with error Error code

done

BOOL

busy

OUT

BOOL

FALSE

error

OUT

BOOL

FALSE 16#00_00 _00_00

errorId
1)

OUT

DWORD

2)

Parameter types: IN = input parameters, OUT = output parameters, IN/OUT = in/out parameters Parameter sort: M = mandatory parameter, O = optional parameter

3.3.4
Siemens AG 2013 All rights reserved

Timing diagram
Fig. 3-4

Copyright

Block processing without error The block is started with a rising edge at the input execute. When starting, the block indicates that it is being actively processed with busy = TRUE. When the block processing has been completed, output busy = FALSE. At the same time, the block signals using done = TRUE that the block functionality has been successfully completed. If execute is set again from FALSE to TRUE before the function is completed, the current processing is canceled and the block again starts to execute the function. All outputs are initialized.

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

2 1

3 Functional mechanisms of this application 3.3 FBInitNetworkDiagnosticsStructure Block processing with error The block is started with a rising edge at execute. 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 error = TRUE and a corresponding ID is displayed at the errorID output. The block can be restarted with execute = TRUE.

3.3.5

Fault messages
Table 3-9 Fault number [HEX] 16#0000 16#1005 16#FFFF80xx No error Internal error: The internal step bit memory of the FB has an invalid value See the online help for the system functions _getSegmentIdentification() _getNextLogAddress() _getStateOfAllDpStations() Meaning

Siemens AG 2013 All rights reserved

3.3.6

Transfer structure "addressDetection"


Every configured network of a SIMOTION control has its own unique diagnostics address; this is used to diagnose the associated stations by the FBInitNetworkDiagnosticsStructure function block. Users can have the block automatically determine these diagnostic addresses, or they can manually enter them at the block. The relevant settings for this are made at the structure gsNetworkAddressDetectionSettings, type sAddressDetectionSettings, which are transferred at input addressDetection at the block.

Copyright

Structure sAddressDetectionSettings
Table 3-107 Structure Parameters Data type P type1) M/O2) Initial value Description

sAddress Detection Settings boAuto DetectionOf Network Addresses


7

BOOL

IN

TRUE

The network diagnostic addresses are determined automatically

ARRAY [1..NUMBER_OF_NETWORKS] OF UDINT

22

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

3 Functional mechanisms of this application 3.3 FBInitNetworkDiagnosticsStructure

Structure

Parameters

Data type

P type1)

M/O2)

Initial value

Description

sAddress Detection Settings boManual Network Address Presetting BOOL IN M FALSE TRUE: Network diagnostic addresses must be manually entered Array, whose elements can be pre-assigned with the required network diagnostic addresses; the array size depends on the value of the constant

au32 Network Diagnostic Address

ARRAY [1..NUMBER_...] OF UDINT

IN

1)

Siemens AG 2013 All rights reserved

2)

Parameter types: IN = input parameters, OUT = output parameters, IN/OUT = in/out parameters Parameter sort: M = mandatory parameter, O = optional parameter

Automatically determining the network diagnostic addresses (default setting) If the function block should automatically determine the network diagnostic addresses, then variable boAutoDetectionOfNetworkAddresses should be set to the value TRUE. This is realized automatically once when calling the block for the first time after a SIMOTION control download. At the same time, variable boManualNetworkAddressPresetting is set to the value FALSE if this previously had the value TRUE (also see Chapter 5.2). The system function _getSegmentIdentification(), which is called in the block, in this case supplies all of the network diagnostic addresses. 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)

Copyright

Constant NUMBER_OF_NETWORKS has a value greater than 3 Variable boAutoDetectionOfNetworkAddresses has the value TRUE Using the variable gboActualisationOfNetworkDiagnosticsStructure, the block functionality can be re-initiated, if this is controlled to the value TRUE

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

2 3

3 Functional mechanisms of this application 3.3 FBInitNetworkDiagnosticsStructure The network diagnostic addresses are determined in the block using the system function _getSegmentIdentification() The function block determines all of the network-associated addresses (i.e. diagnostic addresses and I/O addresses of the configured nodes) as well as the actual states of the station and saves the data in the user structure gasMachineNetwork. This means that the user structure would look like this: gasMachineNetwork[1] contains the data for the PROFIBUS network (X136) with diagnostics address 16382 gasMachineNetwork[2] contains the data for PROFIBUS_Integrated with diagnostics address 16381 gasMachineNetwork[3] contains the data for the PROFINET network (X1400) with the diagnostics address 16349 The block automatically determines the network diagnostic addresses; this means that the user does not need to know them in order to be able to diagnose the networks of his SIMOTION control. Contrary to a manual input at the block, the network diagnostic addresses do not have to be changed, if these change in the HW configuration. The user has no influence as to which networks of his SIMOTION control are diagnosed. All of the networks are diagnosed, if the value of constant NUMBER_OF_NETWORKS is greater or equal to the configured number of networks.

Advantage:

Siemens AG 2013 All rights reserved

Disadvantage:

Manually entering the network diagnostic addresses If the user is to manually enter the network diagnostic addresses at the function block, then variable boManualNetworkAddressPresetting must be set to the value TRUE. At the same time, variable boAutoDetectionOfNetworkAddresses is set to the value FALSE if this previously had the value TRUE (also see Chapter 5.4). The elements of the au32NetworkDiagnosticAddress array must then be preassigned with the network diagnostic addresses, whose stations are to be diagnosed 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)

Copyright

Variable boManualNetworkAddressPresetting has the value TRUE

24

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

3 Functional mechanisms of this application 3.3 FBInitNetworkDiagnosticsStructure The user only wishes to diagnose the PROFIBUS network at interface X136 as well as the PROFINET network at PROFINET interface X150 Constant NUMBER_OF_NETWORKS has a value greater than 2 The elements of the au32NetworkDiagnosticAddress array are preassigned as follows: au32NetworkDiagnosticAddress[1] = 16382 au32NetworkDiagnosticAddress[2] = 16349 au32NetworkDiagnosticAddress[x] = 0

Using the variable gboActualisationOfNetworkDiagnosticsStructure, the block functionality can be re-initiated, if this is controlled to the value TRUE The function block determines all of the network-associated addresses (i.e. diagnostic addresses and I/O addresses of the configured nodes) as well as the actual states of the station and saves the data in the user structure gasMachineNetwork. This means that the user structure would look like this:
Siemens AG 2013 All rights reserved

gasMachineNetwork[1] contains the data for the PROFIBUS network (X136) with diagnostics address 16382 gasMachineNetwork[2] contains the data for the PROFINET network (X1400) with the diagnostics address 16349 gasMachineNetwork[x] does not contain any data The user can determine which and how many networks of his SIMOTION control should be diagnosed by entering the required network diagnostic addresses at the function block. The user must know the corresponding network diagnostic addresses, in order to diagnose the required networks of his SIMOTION control system. If the diagnostic addresses change in the HW configuration, then these must also be changed at the block.

Advantage:

Copyright

Disadvantage:

3.3.7

Transfer structure "counterArray"


The gsCounterArray structure, type sCounterArrayType is used to save all of the address information of the addresses, which were determined by the function block for the particular networks of the SIMOTION control system. This structure is transferred at the counterArray block input. The structure comprises the array asNetworkIndexAndStationNumber, which comprises a total of 16384 array elements (from 0 to 16383, whereby 16383 represents the highest possible diagnostics address in the SIMOTION address space). 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 corresponding array element.

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

2 5

3 Functional mechanisms of this application 3.3 FBInitNetworkDiagnosticsStructure Structure sCounterArrayType


Table 3-11 Structure Parameters Data type P type1) M/O2) Initial value Description

sCounter ArrayType asNetwork IndexAnd Station Number ARRAY [0..16383] OF sAddressType OUT ----Array to save the additional address information of the particular address

Structure sAddressType
Table 3-12 Structure Parameters Data type P type1) M/O2) Initial value Description

sAddress Type
Siemens AG 2013 All rights reserved

sInput sOutput sDiagnostic

sCounterType sCounterType sCounterType

OUT OUT OUT

-------

-------

Structure for input address Structure for output address Structure for diagnostics address

Copyright

Structure sCounterType
Table 3-13 Structure Parameters Data type P type1) M/O2) Initial value Description

sCounter Type u8Network Index Number of the network in which the particular address was determined Number of the station at which the particular address was configured

USINT

OUT

---

u8Station Number
1)

USINT

OUT

---

2)

Parameter types: IN = input parameters, OUT = output parameters, IN/OUT = in/out parameters Parameter sort: M = mandatory parameter, O = optional parameter

26

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

3 Functional mechanisms of this application 3.3 FBInitNetworkDiagnosticsStructure 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 the transfer structure counterArray in the following array elements: asNetworkIndexAndStationNumber[16361] asNetworkIndexAndStationNumber[292] asNetworkIndexAndStationNumber[1024]

As one address can occur several times (e.g. input address 292 and output the address 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, the station number in which the address was determined by the block. This information is subsequently used in the PeripheralFaultTask in order to facilitate that the gasMachineNetwork user structure is quickly updated.

Siemens AG 2013 All rights reserved

3.3.8

Transfer structure "eventCounter"


The structure gasEventCounter, which comprises an array, type sEventCounterType, 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 eventCounter block input.

Copyright

Structure sEventCounterType
Table 3-148 Structure Parameters Data type P type1) M/O2) Initial value Description

sEvent Counter Type ARRAY [1..HIGHEST_...] OF sStationType Array of the structure, which contains fault counters for all stations for each network

asStation

OUT

---

---

1)

2)

Parameter types: IN = input parameters, OUT = output parameters, IN/OUT = in/out parameters Parameter sort: M = mandatory parameter, O = optional parameter

ARRAY [1..HIGHEST_STATION_ADDRESS_AT_NETWORK] OF sStationType

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

2 7

3 Functional mechanisms of this application 3.3 FBInitNetworkDiagnosticsStructure Structure sStationType


Table 3-15 Structure Parameters Data type P type1) M/O2) Initial value Description

sStation Type Counter for ring buffers of the particular station; contains the index of the element, in which a fault was last entered Total number of faults still active at the particular station Total number of faults still active at the particular module of station

u16Last EventIndex

UINT

OUT

---

u16Number OfEvents

UINT

OUT

---

au16Events OnModule
Siemens AG 2013 All rights reserved 1)

ARRAY [1..HIGHEST_...] OF UINT

OUT

---

---

2)

Parameter types: IN = input parameters, OUT = output parameters, IN/OUT = in/out parameters Parameter sort: M = mandatory parameter, O = optional parameter

Copyright

The structure gasEventCounter is updated at runtime in the PeripheralFaultTask. 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 be detected, and corresponding to the actual status of the station, adapted in the gasMachineNetwork 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 the number 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 gasMachineNetwork as DISTURBED. Now, one of the active station faults is resolved. The fault counter of the corresponding module is decremented by a value of 1 and the total number of faults is adapted. The actual status of the station in the user structure is still signaled as DISTURBED. The station is only signaled in the user structure again as IN_OPERATION after all station faults have been resolved.

28

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

3 Functional mechanisms of this application 3.4 FCMachinePeripheralFailureHandling

3.4

FCMachinePeripheralFailureHandling
The FCMachinePeripheralFailureHandling function is used to evaluate the Task-Start-Information (TSI) of the PeripheralFaultTask and to update the user structure gasMachineNetwork. Coming as well as going faults are evaluated, and the fault information (associated with the network and associated with the station) is entered in the network structure. In addition, the fault counters of the stations with faults are incremented or decremented in the gasEventCounter structure, which means that the actual states of the stations are correspondingly adapted in the user structure.

3.4.1

Functionality
The function must be called in the PeripheralFaultTask. Coming as well as going faults are evaluated, and using the address information saved in the gasCounterArray structure, are saved in the user structure, associated with the network and associated with the station.

Siemens AG 2013 All rights reserved

The actual status of the station is updated in the user structure, depending on whether 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 modules are 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 TSI#interruptId TSI#logDiagAdr TSI#logBaseAdrIn TSI#logBaseAdrOut TSI#eventClass Instant that the PeripheralFaultTask started signaled fault ID diagnostic address of the station with a fault input address of the station with fault output address of the station with fault event class (depending on TSI#interruptId) as additional fault information fault ID (depending on TSI#interruptId and TSI#eventClass) as additional fault information detailed information (depending on TSI#interruptId and TSI#eventClass) as additional fault information

Copyright

TSI#faultId

TSI#details

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

2 9

3 Functional mechanisms of this application 3.4 FCMachinePeripheralFailureHandling Overview of the fault IDs, which are evaluated
Table 3-16 TSI#interruptId _SC_PROCESS_INTERRUPT _SC_DIAGNOSTIC_INTERRUPT _SC_STATION_DISCONNECTED _SC_STATION_RECONNECTED _SC_IMAGE_UPDATE_FAILED _SC_IMAGE_UPDATE_OK _SC_IO_MODULE_SYNCHRONIZED _SC_IO_MODULE_NOT_SYNCHRONIZED _SC_PULL_PLUG_INTERRUPT Number 200 201 202 203 204 206 214 215 216 Meaning Process interrupt has occurred on I/O module Diagnostics alarm has occurred on I/O module Station failure of an IO device / DP slave Station return of an IO device / DP slave Faults when generating the process image Generating the process image functions again Module has been synchronized Module is not synchronized Withdrawing or inserting modules of an IODevice / DP-Slave

Siemens AG 2013 All rights reserved

Note

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

3.4.2

Schematic LAD representation


Fig. 3-59

Copyright

ARRAY [1..NUMBER_OF_NETWORKS] OF sNetworkType / sEventCounterType

30

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

3 Functional mechanisms of this application 3.4 FCMachinePeripheralFailureHandling

3.4.3
Table 3-1710 Element

Parameters

P type1) IN IN IN IN IN IN

Data type

M/O2)

Initial value DT#000101-010:0:0 0 0 0 0 16#00_00

Meaning Instant time that PeripheralFaultTask started Diagnostic address of the station with a fault Input address of the station with a fault Output address of the station with a fault Signaled fault ID Event class (depending on TSIInterruptId) as additional fault information Fault ID (depending on TSIInterruptId and TSIEventClass) as additional fault information Detailed information (depending on TSIInterruptId and TSIEventClass) as additional fault information Transfer structure for the address information already determined Structure to transfer the user structure

TSIStartTime TSILogDiag Address TSILogBase AddressIn TSILogBase AddressOut TSIInterruptId TSIEventClass

DT DINT DINT DINT UDINT UINT

M M M M M M

Siemens AG 2013 All rights reserved

TSIFaultId

IN

UINT

16#00_00

TSIDetails

IN

DWORD

16#00_00 _00_00

counterArray

IN/OUT

sCounterArray Type ARRAY [1..NUMBER_...] OF sNetworkType ARRAY [1..NUMBER_...] OF sEventCounter Type

---

Copyright

network

IN/OUT

---

eventCounter

IN/OUT

---

Structure to transfer the fault counters of the stations

1)

2)

Parameter types: IN = input parameters, OUT = output parameters, IN/OUT = in/out parameters Parameter sort: M = mandatory parameter, O = optional parameter

10

ARRAY [1..NUMBER_OF_NETWORKS] OF sNetworkType / sEventCounterType

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

3 1

3 Functional mechanisms of this application 3.4 FCMachinePeripheralFailureHandling

3.4.4

Fault messages
Table 3-18 Fault number [HEX] 16#0000 16#1007 No error No network index and/or no station number was able to be found in the address information for the address that was signaled as having a fault The FaultId signaled from PeripheralFaultTask is unknown The diagnostics address signaled from PeripheralFaultTask is unknown The logical address signaled from PeripheralFaultTask is unknown Meaning

16#1008 16#1009 16#1010

Copyright

Siemens AG 2013 All rights reserved

32

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

4 Startup of the application 4.1 Overview

4
4.1

Startup of the application


Overview
The zip archive 53705461_SIMOTION_Diagnostics_V2_0.zip supplied with this application example includes the ST sources required for diagnostics. The ST source fMachineNetworkDiagnostics contains the function blocks FBGetStateOfAllStationsAtNetwork and FBInitNetworkDiagnosticsStructure as well as the FCMachinePeripheralFailureHandling function. The ST source pMachineNetworkDiagnostics contains the programs for the BackgroundTask as well as the PeripheralFaultTask, in which the function blocks as well as the function are called. The program pMachineNetworkDiagnosticsBackgroundTask should be preferably integrated into the BackgroundTask. The program pMachineNetworkDiagnosticsPeripheralFaultTask must be integrated into the PeripheralFaultTask.

Siemens AG 2013 All rights reserved

4.2

Integrating ST sources
The ST sources fMachineNetworkDiagnostics as well as pMachineNetworkDiagnostics can be integrated in a new as well as in an existing project.
Table 4-1 No. 1. 2. 3. Extract the ZIP archive supplied. Open the project in which the ST sources should be integrated. In the project tree, open the properties of the required SIMOTION control and select the PROGRAMS subfolder. The shortcut menu opens with a right-click. Here, select the option "Import external source > ST source file". Action

Copyright

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

3 3

4 Startup of the application 4.3 Linking in the programs

No. 4.

Action Select the ST sources fMachineNetworkDiagnostics and pMachineNetworkDiagnostics (keep the Ctrl key pressed), and click on the "Open" button. Start the import by pressing the "OK" button. No other settings must be made.

5.

Siemens AG 2013 All rights reserved

Copyright

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 the corresponding tasks.
Table 4-2 No. 1. Action In the project tree, open the Execution system of the SIMOTION control system.

34

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

4 Startup of the application 4.3 Linking in the programs

No. 2.

Action Select the BackgroundTask and link in the pMachineNetworkDiagnosticsBackgroundTask program using the ">>" button into the task.

Siemens AG 2013 All rights reserved

Note Proceed in the same way for the pMachineNetworkDiagnosticsPeripheralFaultTask program. Note that the program must be linked into the PeripheralFaultTask! 3. Save and compile the project.

4.

Load the modified settings into the SIMOTION controller.

Copyright

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

3 5

5 Operating the application 5.1 Adapting the value of the global constants

5
5.1

Operating the application


Adapting the value of the global constants
Global constants are used in the application example, which the user can adapt to further optimize the diagnostic functions.
Table 5-1 No. 5. Action The global constants are located in the ST source fMachineNetworkDiagnostics and default values are assigned to them (see Chapter 2.2: Description of the core functionality). Adapt the values corresponding to your configuration.

Siemens AG 2013 All rights reserved

6.

Save and compile the project.

7.

Load the modified settings into the SIMOTION controller.

Copyright

Note

The values of the constants should always be selected corresponding to the SIMOTION configuration, as otherwise, after initiating the diagnostic functionality once, more cycle time is required in the BackgroundTask than is absolutely necessary.

Note

If the variables of the diagnostic functionality are to be accessed from an HMI (i.e. variables of the user structure gasMachineNetwork), then it must be ensured that all HMI-relevant variables lie below the 64kByte address limit for HMI access operations. If the 64kByte address limit is exceeded, when compiling, the compiler outputs an alarm indicating that from the user structure gasMachineNetwork onwards, it is no longer possible for the HMI to access variables:

When using the standard values of the constants, for the user structure gasMachineNetwork a size of approx. 1125kByte is obtained; as a consequence, 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 the values.

36

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

5 Operating the application 5.2 Automatic execution of the diagnostic functionality

Note

The actual size of the user structure is displayed in the i32SizeOfGasMachineNetwork variable. This is written once to the pMachineNetworkDiagnosticsBackgroundTask program after the SIMOTION control has been downloaded.

If the size of the user structure cannot be reduced as a result of the SIMOTION configuration to the address limit of 64kByte by adapting the values of the constants, then the required files must be copied over into another structure, which the HMI can then access.
Siemens AG 2013 All rights reserved

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 networks configured at the SIMOTION control are automatically diagnosed, and the diagnostics data is saved in the gasMachineNetwork user structure. If, in the meantime, the manual input of network diagnostic addresses function has been used (see Chapter 5.4), then using the following setting, you can switch back to automatically determining the diagnostics data.
Table 5-2 No. 8. Action To do this, in the PROGRAMS folder of the SIMOTION control, select the ST source pMachineNetworkDiagnostics. The content of the ST source is displayed in the symbol browser. There, open the gsNetworkAddressDetectionSettings global structure.

Copyright

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

3 7

5 Operating the application 5.2 Automatic execution of the diagnostic functionality

No. 9.

Action Using the "Control" button, change the variable boAutoDetectionOfNetworkAddresses to the value "TRUE".

Siemens AG 2013 All rights reserved

Note The variable boManualNetworkAddressPresettings is automatically set to the value "FALSE". Network diagnostic addresses possibly entered in array au32NetworkDiagnosticAddress are ignored with this setting of the function block FBInitNetworkDiagnosticStructure. 10. Using the "Control" button, change the variable gboActualisationOfNetworkDiagnosticsStructure to the value "TRUE".

Copyright

Note After executing the function block FBInitNetworkDiagnosticStructure the global variable is automatically reset to the value "FALSE".

38

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

5 Operating the application 5.3 Manually initiating the diagnostics functionality

5.3

Manually initiating the diagnostics functionality


If required, the diagnostics functionality can also be manually initiated by the user.
Table 5-3 No. 11. Action To do this, in the PROGRAMS folder of the SIMOTION control, select the ST source pMachineNetworkDiagnostics. The content of the ST source is displayed in the symbol browser. Using the "Control" button, change the variable gboActualisationOfNetworkDiagnosticsStructure to the value "TRUE".

12.

Siemens AG 2013 All rights reserved

Note After executing the function block FBInitNetworkDiagnosticStructure the global variable is automatically reset to the value "FALSE". 13. The function blocks FBInitNetworkDiagnosticStructure andFBGetStateOfAllStationsAtNetwork are executed again. All configured stations as well as the actual state are determined and saved in the user structure gasMachineNetwork.

Copyright

Note

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

5.4

Manually entering the network diagnostic addresses


When required (see Chapter 3.3.6: Transfer structure "addressDetection") the diagnostic addresses of the networks, which are to be diagnosed, can be manually entered by the user at the FBInitNetworkDiagnosticStructure function block.
Table 5-4 No. 14. Action Open the HW configuration of the SIMOTION control, whose networks you wish to diagnose.

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

3 9

5 Operating the application 5.4 Manually entering the network diagnostic addresses

No. 15.

Action 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 diagnostic addresses.

Siemens AG 2013 All rights reserved

Note Only the diagnostic addresses of the interfaces ( not the ports!) can be transferred to the function block. If incorrect diagnostic addresses are transferred to the block, then no diagnostics data can be determined for it. 16. Change into SIMOTION SCOUT and in the folder PROGRAMS of the SIMOTION control, select the ST source pMachineNetworkDiagnostics. The content of the ST source is displayed in the symbol browser. In the symbol browser, open the global structure gsNetworkAddressDetectionSettings as well as array au32NetworkDiagnosticAddress contained in it.

17.

Copyright

Note The size of the array depends on the value of the constant NUMBER_OF_NETWORKS in the ST source fMachineNetworkDiagnostics. As a consequence, only this maximum number of network diagnostic addresses can be specified at the block.

40

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

5 Operating the application 5.4 Manually entering the network diagnostic addresses

No. 18.

Action Using the "Control" button, change the variable boManualNetworkAddressPresetting to the value "TRUE".

Note The variable boAutoDetectionOfNetworkAddresses is automatically set to the value "FALSE".


Siemens AG 2013 All rights reserved

19.

Copyright

Then enter the required network diagnostic addresses in the elements of the au32NetworkDiagnosticAddress array, and accept these also using the "control" button. Note It is not absolutely necessary that all array elements are assigned a diagnostics address. For elements with the value "0", the block does not determine any diagnostics data; as a consequence, the corresponding elements of the user structure contain their standard values. However, for performance reasons, it makes more sense in such a case to appropriately adapt the value of the NUMBER_OF_NETWORKS constant. Using the "Control" button, change the variable gboActualisationOfNetworkDiagnosticsStructure to the value "TRUE", to initiate the diagnostics functionality for the selected networks.

20.

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

4 1

5 Operating the application 5.4 Manually entering the network diagnostic addresses

No. 21.

Action All of the stations configured in the selected networks as well as their actual state are determined, and saved in the gasMachineNetwork user structure. The sequence of the diagnostic addresses transferred at the block corresponds to the sequence of the data that were saved in the user structure. For instance, if network diagnostic address 16349 is transferred to array element au32NetworkDiagnosticAddress[2] then after executing the function block FBInitNetworkDiagnosticStructure, the determined diagnostics data for this network are also located in array element gasMachineNetwork[2] of the user structure.

Copyright

Siemens AG 2013 All rights reserved

42

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

6 References 6.1 Internet links

6
6.1

References
Internet links
This list does not purport to be complete and merely reflects a selection of suitable information.
Table 6-1 Topic \1\ \2\ Reference to the article Siemens Industry Online Support Title
http://support.automation.siemens.com/WW/view/en/53705461 http://support.automation.siemens.com

7
Siemens AG 2013 All rights reserved

Contacts
Siemens AG Industry Sector I DT MC PMA APC Frauenauracher Str. 80 91056 Erlangen, Germany E-mail: profinet.team.motioncontrol.i-dt@siemens.com

History
Table 8-1 Version V1.0 V2.0 Date 06/2011 06/2013 First edition Revised version, ST sources and documentation have been revised Change

Copyright

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

4 3