Siemens SCL: short question about alarms / warnings / events

dezuiper

Member
Join Date
Dec 2017
Location
Belgium
Posts
6
I am new to PLC programming.
Is there a standard way to incorporate alarms / warnings / events such as the exceptions in C++ or Java where you can throw and catch exceptions at the appropiate function block?

Or is there no system in place and is everything user defined by warning bools or bytes with bit manipulation and the HMI system moniters these alarm tags?
 
Hi dezuiper (is it carnival yet?)

Siemens uses organisation blocks OB to handle errors and exceptions, you can write code within these, or use system function(block) to read out data.

For example, we use SFC51 to read the status of our profibus slaves:
CALL "RDSYSST"
REQ :=M86.0 // trigger lesing - f.eks hvert sekund, eller som her fra OB86
SZL_ID :=W#16#294 // liste-ID
INDEX :=W#16#1 // DP-mastersystem nr. Fra HW-config. Default = 1 des.
RET_VAL :=MW100
BUSY :=M102.0
SZL_HEADER:=DB505.SSL_Header
DR :=P#DB505.DBX4.0 BYTE 258 // peker til mottatt liste.
 
As Boneless said, traditionally, Siemens uses OBs to interrupt your code when the PLC detects various errors and faults. Then you can execute your code in the OBs to handle various errors. The upside is that this is built in standard behavior; the downside is that the trigger conditions can't really be customized.

Assuming you're using Portal and the newer 1200/1500:

Another option for runtime errors (read error, invalid pointer, invalid FB call, etc) is to use the instructions GET_Error or GET_ERR_ID. This allows you to handle the errors locally in your code.

As far as getting alarms to the HMI, the method you mentioned is one option, where you tie alarm text on the HMI to a bit in a word in the PLC. Another option is to use the Program Alarm instruction within an FB. You can create dynamic text in the PLC, to incorporate tags and other data in your alarm text. This text can then be displayed on the HMI, the PLC web page, in Portal all at the same time.

For HW events, the 1500 has built in system diagnostics to automatically create alarms for things like short circuits, unplugged IO modules, etc.
 
Depends on what level you mean to do this as you can't really throw an exception through code.
The PLC will catch exceptions and give you the ability to program a response through the OB's and diagnostic functions, but you can't throw an error on a parameter being received.

Part of this is that the concept of exceptions is minimised by the OS of the PLC and that it is generally something used at a higher level of programming than a PLC would generally be. I know lines are blurring between what was the domain of a PLC and what was for a computer, but programming wise these are still there.

One nifty thing you can do, although not completely related is that you can write to the diagnostic buffer through an SFC, which may be useful for some debug/diagnostic.
 
Maybe dezuiper means software errors and not hardware errors.

You have the "programming error" OB121 for software faults. See the online help for which information you can extract from OB121.

A math overflow does not trigger OB121. To catch math overflows you must query the "OV" system bit in code.
 
A quick and easy way to display extensive information for software and hardware errors (if maybe a bit cryptic for the enduser), is to simply activate the webserver on the CPU. Anyone can then access the CPU diagnostics buffer with a webbrowser.
 

Similar Topics

Hello, When you want compare values of an array to a range of numbers is it a right way to do that? FUNCTION ADD VAR_IN_OUT A:ARRAY[1..50]...
Replies
5
Views
2,063
Hi All, I need to try and convert some code from Siemens SCL (TIA16) over to Allen Bradley RS5000. I have attached an image of the SCL and what...
Replies
10
Views
4,045
in the scl code written in screenshot Line 1 condition is false but still the program checking the line 2 condition and says it is true i had...
Replies
3
Views
1,750
Hello All, I am new to programming with Tia Portal and I am having difficulty with something that we have found "easy" in other programming...
Replies
3
Views
2,367
Could someone help me to convert following from STL to SCL? AN #PV_EXT_S JC MEAS L #PV_EXT L 1.000000e+000...
Replies
9
Views
2,685
Back
Top Bottom