-
Notifications
You must be signed in to change notification settings - Fork 0
/
Programming error FB.scl
76 lines (67 loc) · 2.71 KB
/
Programming error FB.scl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
FUNCTION_BLOCK "Programming error FB"
TITLE = Programming error FB
{ S7_Optimized_Access := 'TRUE' }
VERSION : 1.0
VAR_INPUT
BlockNr { ExternalAccessible := 'False'; ExternalVisible := 'False'; ExternalWritable := 'False'} : UInt; // Number of causing block
BlockType { ExternalAccessible := 'False'; ExternalVisible := 'False'; ExternalWritable := 'False'} : USInt; // 16#01:OB, 16#02:FC, 16#03:FB, 16#04:SFC, 16#05:SFB, 16#06:DB: Type of block causing the error
DBNr { ExternalAccessible := 'False'; ExternalVisible := 'False'; ExternalWritable := 'False'} : DB_ANY; // DB number if Area = DB or DI
END_VAR
VAR_OUTPUT
"o-message" : String;
END_VAR
VAR_IN_OUT
"io-error" : Bool;
END_VAR
VAR_TEMP
"t-error" : Bool;
"t-error message" : String;
"t-block type" : String;
"t-block nr" : String;
"t-db nr" : String;
END_VAR
BEGIN
//=============================================================================
// Company: ÅF Pöyry AB (c)Copyright (2020)
//-----------------------------------------------------------------------------
// Library: N/A
// Tested with: N/A
// Engineering: TIA Portal V16
// Restrictions: N/A
// Requirements: OB121
// Functionality: Hanterar Larm från OB121.
// Anropet skall ligga i OB121.
// Larmet skall ha en reset flagga direkt
// efter larm till panel sätts.
//-----------------------------------------------------------------------------
// Change log table:
// Version Date Author Changes applied
// V0.1 30.03.2020 DRA First draft
CASE #BlockType OF
1:
#"t-block type" := string#'OB';
2:
#"t-block type" := string#'FC';
3:
#"t-block type" := string#'FB';
4:
#"t-block type" := string#'SFC';
5:
#"t-block type" := string#'SFB';
6:
#"t-block type" := string#'DB';
ELSE
#"t-block type" := '';
END_CASE;
#"t-block nr" := UINT_TO_STRING(#BlockNr);
#"t-db nr" := UINT_TO_STRING(#DBNr);
IF #BlockNr <> 0 AND #BlockType <> 0 AND #DBNr <> 0 THEN
#"t-error message" := CONCAT_STRING(IN1 := 'Programmeringsfel i: ', IN2 := #"t-block type");
#"t-error message" := CONCAT_STRING(IN1 := #"t-error message", IN2 := #"t-block nr");
#"t-error message" := CONCAT_STRING(IN1 := #"t-error message", IN2 := ' ');
#"t-error message" := CONCAT_STRING(IN1 := #"t-error message", IN2 := 'som anropar datablock: ');
#"t-error message" := CONCAT_STRING(IN1 := #"t-error message", IN2 := #"t-db nr");
#"o-message" := #"t-error message";
#"io-error" := True;
END_IF;
END_FUNCTION_BLOCK