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.
Copyright
Siemens AG 2013 All rights reserved
http://support.automation.siemens.com/WW/view/en/50203404
2
Diagnosing station failures and module states Version V2.0, Entry ID: 53705461
s
1
Solution
2
Functional mechanisms of this application
3
Startup of the application
4
Operating the application
5
References
6
Contacts
7
History
8
Copyright
Siemens AG 2013 All rights reserved
SIMOTION Diagnosing station failures and module states
Task
Diagnosing station failures and module states Version V2.0, Entry ID: 53705461
3
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.
Copyright
Siemens AG 2013 All rights reserved
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.
4
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
Solution........................................................................................................... 7 2.1 2.2 2.3
3
Overview ......................................................................................... 33 Integrating ST sources ..................................................................... 33 Linking in the programs.................................................................... 34
Operating the application............................................................................. 36
Siemens AG 2013 All rights reserved Copyright
5.1 5.2 5.3 5.4 6
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
Startup of the application............................................................................. 33 4.1 4.2 4.3
5
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
4
Overview ........................................................................................... 6
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
Contacts........................................................................................................ 43
8
History .......................................................................................................... 43
Diagnosing station failures and module states Version V2.0, Entry ID: 53705461
5
1 Task 1.1 Overview
1
Task
1.1
Overview
Overview of the automation task The following figure provides an overview of the automation task. Fig. 1-1
PROFINET PROFIBUS SIMOTION
Siemens AG 2013 All rights reserved
I/Os
Drive
I-Device
I-Slave
…
…
Copyright
I/Os
Drive
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.
6
Diagnosing station failures and module states Version V2.0, Entry ID: 53705461
2 Solution 2.1 Overview of the overall solution
2
Solution
2.1
Overview of the overall solution
Schematic diagram The following schematic diagram shows the most important components of the solution: Fig. 2-1
PROFINET ET200S IM 151 DP HF
SIMOTION D435-2 DP/PN (+ CBE30-2)
Copyright
Siemens AG 2013 All rights reserved
PROFIBUS
SINAMICS G120 CU240E-2 DP
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
7
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
Copyright
Siemens AG 2013 All rights reserved
The following system functions provided by SIMOTION are used in the application example: _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.
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)
8
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
Programming language
Know-how protection
pMachineNetworkDiagnostics
ST
No
fMachineNetworkDiagnostics
ST
No
Function/function block
Property
Must be adapted to the application
This function block determines the actual states of all configured stations.
No
FBInitNetworkDiagnosticsStructure
This function block is used to initialize the diagnostics structure.
No
FCMachinePeripheralFailureHandling
This function is used to evaluate the task start information of the PeripheralFaultTask.
No
Copyright
Siemens AG 2013 All rights reserved
FBGetStateOfAllStationsAtNetwork
Diagnosing station failures and module states Version V2.0, Entry ID: 53705461
9
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
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 software components 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 projects The list below contains all the files and projects used in this example.
Copyright
Siemens AG 2013 All rights reserved
Table 2-3
Table 2-4 Component
10
Note
53705461_SIMOTION_Diagnostics_V2_0_en.pdf
This document
53705461_SIMOTION_Diagnostics_V2_0.zip
ZIP archive with the ST sources required for the diagnostics
Diagnosing station failures and module states Version V2.0, Entry ID: 53705461
3 Functional mechanisms of this application 3.1 User structure "gasMachineNetwork"
3
Functional mechanisms of this application
3.1
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
eTypeOf Network
Enum Network Type
P type1)
M/O2)
Initial value
OUT
---
UNKNOWN
Displays the network type
0
Number of configured stations in the network
Description
Siemens AG 2013 All rights reserved
sNetwork Type
Copyright
u8NumberOf StationsAt Network
2)
1
OUT
---
u8NumberOf Disturbed Stations
USINT
OUT
---
0
Number of currently faulty stations in the network
u8Last Disturbed Station
USINT
OUT
---
0
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)
asStation
1)
USINT
ARRAY [1.HIGHEST_...] OF sStateOf DevicesAt NetworkType
OUT
---
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
i32 Diagnostic Address
DINT
OUT
---
0
Diagnostic address of the station
eActualState
Enum StateOf DpStation
OUT
---
NO_VALID _STATE
Current state of the station
Description
sStateOf DevicesAt Network Type
Siemens AG 2013 All rights reserved
u32 InterruptId
b16Event Class
WORD
WORD
OUT
OUT
OUT
---
---
---
0
16#00_00
Event class (depending on u32InterruptId) as additional fault information
16#00_00
Fault identification (depending on u32InterruptId and b16EventClass) as additional fault information
16#00_00 _00_00
Detailed information (depending on u32InterruptId and b16EventClass) on the prevailing fault
Copyright
b16FaultId
UDINT
Fault, which was signaled for this station in the PeripheralFaultTask
b32Details
2
DWORD
OUT
---
u8NumberOf Disturbed Modules
USINT
OUT
---
0
Number of currently faulty modules ( I/O addresses) of the station
u8Last Disturbed Module
USINT
OUT
---
0
Number of the last faulty module of the station
sEvent History
sEvent History Type
---
Structure, which is used to save the faults at the station (see Table 3-3)
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
asModule
1)
OUT
---
---
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
sEvent HistoryType
Copyright
Siemens AG 2013 All rights reserved
2)
ARRAY [1..HIGHEST_...] OF sModuleType
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)
u16Last EventIndex
asEvent
1)
2)
3
UINT
ARRAY [1..NUMBER_...] OF sEventType
OUT
OUT
0
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)
---
---
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
dtEvent Occurred
u32 InterruptId
Siemens AG 2013 All rights reserved
b16Event Class
b16FaultId
DT
UDINT
WORD
WORD
OUT
OUT
OUT
OUT
---
---
---
---
DT#000101-010:0:0
Instant time that PeripheralFaultTask is called (i.e. the instant in time of the coming/going fault)
0
Fault, which was signaled for this station in the PeripheralFaultTask
16#00_00
Event class (depending on u32InterruptId) as additional fault information
16#00_00
Fault identification (depending on u32InterruptId and b16EventClass) as additional fault information
DWORD
OUT
---
16#00_00 _00_00
u8Disturbed Module
USINT
OUT
---
0
Number of modules at which the fault has occurred
Copyright
b32Details
Detailed information (depending on u32InterruptId and b16EventClass) on the prevailing fault
1)
2)
14
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
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
i32Logical Address
DINT
OUT
---
0
eAddress Type
EnumModule Type
OUT
---
NO_VALID _TYPE
u32Length OfAddress
UDINT
OUT
---
0
Length of the module address in bytes
0
Fault, which was signaled for this module in the PeripheralFaultTask
Description
sModule Type
u32 InterruptId
Siemens AG 2013 All rights reserved
b16Event Class
WORD
WORD
OUT
OUT
OUT
---
---
---
b32Details
1)
2)
DWORD
OUT
---
Type of logical address
16#00_00
Event class (depending on u32InterruptId) as additional fault information
16#00_00
Fault identification (depending on u32InterruptId and b16EventClass) as additional fault information
16#00_00 _00_00
Detailed information (depending on u32InterruptId and b16EventClass) on the prevailing fault
Copyright
b16FaultId
UDINT
Logical address of the module
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.
Siemens AG 2013 All rights reserved
The block is called by specifying the diagnostics address (diagAddressOfNetwork) of the corresponding network.
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.
Copyright
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.
3.2.2
Schematic LAD representation Fig. 3-14
4
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
Parameters
Copyright
Siemens AG 2013 All rights reserved
Table 3-65 Element
P type1)
Data type
M/O2)
Initial value
execute
IN
BOOL
M
FALSE
diagAddressOf Network
IN
UDINT
M
0
Diagnostics address of the network to be diagnosed
stateOfStations
IN/OUT
ARRAY [1..HIGHEST_...] OF sStateOfDevices AtNetworkType
M
-
Transfer structure for the status of the stations and their modules (also see Table 3-2)
numberOf Stations
IN/OUT
INT
M
0
Transfer structure for the number of stations in the network
1)
2)
Meaning TRUE: Start of the functionality
done
OUT
BOOL
-
FALSE
Job being processed
busy
OUT
BOOL
-
FALSE
Processing completed
error
OUT
BOOL
-
FALSE
TRUE: Error when calling the function
errorId
OUT
DWORD
-
16#00_00 _00_00
Error code
Parameter types: IN = input parameters, OUT = output parameters, IN/OUT = in/out parameters Parameter sort: M = mandatory parameter, O = optional parameter
3.2.4
Timing diagram Fig. 3-2
5
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.
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
Copyright
Siemens AG 2013 All rights reserved
When starting, the block indicates that it is being actively processed with busy = TRUE.
Fault messages Table 3-7 Fault number [HEX] 16#0000
No error
16#1005
Internal error: The internal step bit memory of the FB has an invalid value
16#1006
Internal error: The runtime of the _getStateOfAllDpStations() function has exceeded the maximum time of 20 seconds
16#FFFF80xx
18
Meaning
See the online help for the system function _getStateOfAllDpStations()
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.
Copyright
Siemens AG 2013 All rights reserved
The function block has now been executed and when required, can be re-initiated by 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 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].
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
3.3.3
Parameters
Table 3-8 Element
P type1)
Data type
M/O2)
Initial value
execute
IN
BOOL
M
FALSE
TRUE: Start of the functionality
address Detection
IN
sAddress Detection Type
M
-
Transfer structure to define the automatic determination of the network diagnostic addresses for manual input (see Chapter 3.3.6)
counterArray
IN/OUT
sCounter ArrayType
M
-
Transfer structure to save all of the address information (see Chapter 3.3.7)
IN/OUT
ARRAY [1..NUMBER_...] OF sNetwork Type
-
Transfer structure to save the determined data in the user structure (see also Table 3-1)
IN/OUT
ARRAY [1..NUMBER_...] OF sEvent Counter Type
-
Transfer structure to clear the error account of the stations when the block functionality is re-initiated (see Chapter 3.3.8)
Copyright
Siemens AG 2013 All rights reserved
Fig. 3-36
network
eventCounter
6
M
M
Meaning
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
1)
2)
Element
P type1)
Data type
M/O2)
Initial value
done
OUT
BOOL
-
FALSE
TRUE: Function block being processed
busy
OUT
BOOL
-
FALSE
TRUE: Function block successfully completed
error
OUT
BOOL
-
FALSE
TRUE: Function block cancelled with error
errorId
OUT
DWORD
-
16#00_00 _00_00
Error code
Parameter types: IN = input parameters, OUT = output parameters, IN/OUT = in/out parameters Parameter sort: M = mandatory parameter, O = optional parameter
3.3.4
Timing diagram Fig. 3-4
Copyright
Siemens AG 2013 All rights reserved
Meaning
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
No error
16#1005
Internal error: The internal step bit memory of the FB has an invalid value
16#FFFF80xx
See the online help for the system functions _getSegmentIdentification() _getNextLogAddress() _getStateOfAllDpStations()
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.
Copyright
Siemens AG 2013 All rights reserved
Meaning
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. 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
M
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
au32 Network Diagnostic Address
Copyright
Siemens AG 2013 All rights reserved
1)
2)
BOOL
ARRAY [1..NUMBER_...] OF UDINT
IN
IN
M
O
FALSE
TRUE: Network diagnostic addresses must be manually entered
0
Array, whose elements can be pre-assigned with the required network diagnostic addresses; the array size depends on the value of the constant
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)
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.
Disadvantage: –
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.
Manually entering the network diagnostic addresses
Copyright
Siemens AG 2013 All rights reserved
Advantage:
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)
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.
Siemens AG 2013 All rights reserved
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 the PROFINET network (X1400) with the diagnostics address 16349
–
gasMachineNetwork[x] does not contain any data
Advantage: –
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.
Copyright
Disadvantage:
3.3.7
–
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.
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
asNetwork IndexAnd Station Number
ARRAY [0..16383] OF sAddressType
P type1)
M/O2)
Initial value
Description
sCounter ArrayType 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
sInput
sCounterType
OUT
---
---
Structure for input address
sOutput
sCounterType
OUT
---
---
Structure for output address
sDiagnostic
sCounterType
OUT
---
---
Structure for diagnostics address
Data type
P type1)
M/O2)
Initial value
Description
Copyright
Siemens AG 2013 All rights reserved
sAddress Type
Structure sCounterType Table 3-13 Structure
Parameters
Description
sCounter Type u8Network Index
u8Station Number 1)
2)
26
USINT
USINT
OUT
OUT
---
---
0
Number of the network in which the particular address was determined
0
Number of the station at which the particular address was configured
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
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.
Copyright
Siemens AG 2013 All rights reserved
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.
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.
Structure sEventCounterType Table 3-148 Structure
Parameters
Data type
asStation
ARRAY [1..HIGHEST_...] OF sStationType
P type1)
M/O2)
Initial value
Description
sEvent Counter Type
1)
2)
8
OUT
---
---
Array of the structure, which contains fault counters for all stations for each network
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
1)
2)
u16Last EventIndex
UINT
OUT
---
0
Counter for ring buffers of the particular station; contains the index of the element, in which a fault was last entered
u16Number OfEvents
UINT
OUT
---
0
Total number of faults still active at the particular station
au16Events OnModule
ARRAY [1..HIGHEST_...] OF UINT
---
Total number of faults still active at the particular module of station
OUT
---
Parameter types: IN = input parameters, OUT = output parameters, IN/OUT = in/out parameters Parameter sort: M = mandatory parameter, O = optional parameter
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.
Copyright
Siemens AG 2013 All rights reserved
sStation Type
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.
Copyright
Siemens AG 2013 All rights reserved
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. 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
Instant that the PeripheralFaultTask 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 on TSI#interruptId) as additional fault information
–
TSI#faultId
fault ID (depending on TSI#interruptId and TSI#eventClass) as additional fault information
–
TSI#details
detailed information (depending on TSI#interruptId and TSI#eventClass) as additional fault information
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 TSI#interruptId
Number
_SC_PROCESS_INTERRUPT
200
Process interrupt has occurred on I/O module
_SC_DIAGNOSTIC_INTERRUPT
201
Diagnostics alarm has occurred on I/O module
_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 functions again
_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 IODevice / DP-Slave
Note
3.4.2
Meaning
Additional information on the topic "Task-Start-Information (TSI)" is provided in the SIMOTION SCOUT online help under the keyword "TSI".
Schematic LAD representation Fig. 3-59
Copyright
Siemens AG 2013 All rights reserved
Table 3-16
9
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
Parameters
Table 3-1710 Element
P type1)
Data type
M/O2)
TSIStartTime
IN
DT
M
DT#000101-010:0:0
Instant time that PeripheralFaultTask started
TSILogDiag Address
IN
DINT
M
0
Diagnostic address of the station with a fault
TSILogBase AddressIn
IN
DINT
M
0
Input address of the station with a fault
TSILogBase AddressOut
IN
DINT
M
0
Output address of the station with a fault
TSIInterruptId
IN
UDINT
M
0
Signaled fault ID
TSIEventClass
IN
UINT
M
16#00_00
Event class (depending on TSIInterruptId) as additional fault information
M
16#00_00
Fault ID (depending on TSIInterruptId and TSIEventClass) as additional fault information Detailed information (depending on TSIInterruptId and TSIEventClass) as additional fault information
UINT
TSIDetails
IN
DWORD
M
counterArray
IN/OUT
sCounterArray Type
M
---
Transfer structure for the address information already determined
network
IN/OUT
ARRAY [1..NUMBER_...] OF sNetworkType
M
---
Structure to transfer the user structure
IN/OUT
ARRAY [1..NUMBER_...] OF sEventCounter Type
M
---
Structure to transfer the fault counters of the stations
eventCounter
1)
2)
10
IN
Meaning
16#00_00 _00_00
Copyright
Siemens AG 2013 All rights reserved
TSIFaultId
Initial value
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_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]
Meaning No error
16#1007
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
16#1008
The FaultId signaled from PeripheralFaultTask is unknown
16#1009
The diagnostics address signaled from PeripheralFaultTask is unknown
16#1010
The logical address signaled from PeripheralFaultTask is unknown
Copyright
Siemens AG 2013 All rights reserved
16#0000
32
Diagnosing station failures and module states Version V2.0, Entry ID: 53705461
4 Startup of the application 4.1 Overview
4
Startup of the application
4.1
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.
Copyright
Siemens AG 2013 All rights reserved
The program pMachineNetworkDiagnosticsBackgroundTask should be preferably integrated into the BackgroundTask. The program pMachineNetworkDiagnosticsPeripheralFaultTask must be integrated into the PeripheralFaultTask.
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.
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 select the PROGRAMS subfolder. The shortcut menu opens with a right-click. Here, select the option "Import external source > ST source file".
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.
Action Select the ST sources fMachineNetworkDiagnostics and pMachineNetworkDiagnostics (keep the Ctrl 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.
Copyright
Siemens AG 2013 All rights reserved
4.
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.
34
Action In the project tree, open the Execution system of the SIMOTION control system.
Diagnosing station failures and module states Version V2.0, Entry ID: 53705461
4 Startup of the application 4.3 Linking in the programs
No.
Select the BackgroundTask and link in the pMachineNetworkDiagnosticsBackgroundTask program using the ">>" button into the task.
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
Siemens AG 2013 All rights reserved
2.
Action
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
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 to further optimize the diagnostic functions. Table 5-1
Copyright
Siemens AG 2013 All rights reserved
No.
Action
5.
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.
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 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.
Copyright
Siemens AG 2013 All rights reserved
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.
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.
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. Using the "Control" button, change the variable gboActualisationOfNetworkDiagnosticsStructure to the value "TRUE".
Copyright
10.
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
Copyright
Siemens AG 2013 All rights reserved
No.
Action
11.
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.
12.
Using the "Control" button, change the variable gboActualisationOfNetworkDiagnosticsStructure to the value "TRUE".
Note After executing the function block FBInitNetworkDiagnosticStructure the global variable is automatically reset to the value "FALSE". 13.
Note
5.4
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.
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!
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.
Copyright
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.
17.
In the symbol browser, open the global structure gsNetworkAddressDetectionSettings as well as array au32NetworkDiagnosticAddress contained in it.
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".
Copyright
Siemens AG 2013 All rights reserved
Note The variable boAutoDetectionOfNetworkAddresses is automatically set to the value "FALSE". 19.
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.
20.
Using the "Control" button, change the variable gboActualisationOfNetworkDiagnosticsStructure to the value "TRUE", to initiate the diagnostics functionality for the selected networks.
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
Action
21.
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
No.
42
Diagnosing station failures and module states Version V2.0, Entry ID: 53705461
6 References 6.1 Internet links
6
References
6.1
Internet links This list does not purport to be complete and merely reflects a selection of suitable information. Table 6-1 Topic
7
Title
\1\
Reference to the article
http://support.automation.siemens.com/WW/view/en/53705461
\2\
Siemens Industry Online Support
http://support.automation.siemens.com
Contacts
Copyright
Siemens AG 2013 All rights reserved
Siemens AG Industry Sector I DT MC PMA APC Frauenauracher Str. 80 91056 Erlangen, Germany E-mail:
[email protected]
8
History Table 8-1 Version
Date
V1.0
06/2011
First edition
V2.0
06/2013
Revised version, ST sources and documentation have been revised
Diagnosing station failures and module states Version V2.0, Entry ID: 53705461
Change
4 3