0% found this document useful (0 votes)
127 views2 pages

Operate SCL

This document defines a function block that handles operation messages. It takes various input signals and parameters and calls an ALARM_8P block to generate an alarm, passing the input data to the alarm block. It then assigns the output variables of the alarm block to output variables of the function block. The purpose is to generate alarms using an alarm block instance based on the input signals and parameters.

Uploaded by

Bassel Almouie
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
127 views2 pages

Operate SCL

This document defines a function block that handles operation messages. It takes various input signals and parameters and calls an ALARM_8P block to generate an alarm, passing the input data to the alarm block. It then assigns the output variables of the alarm block to output variables of the function block. The purpose is to generate alarms using an alarm block instance based on the input signals and parameters.

Uploaded by

Bassel Almouie
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

FUNCTION_BLOCK OPERATE

TITLE = 'OperationMessage'{
S7_tasklist:='OB32';
S7_m_c:='true';
S7_alarm_ui := '1' //1=PCS7-Message dialog; 0=Standard message dialog
}
AUTHOR : ATEAM
NAME : OPERATE
FAMILY : ATEAM
VERSION : '1.0'
VAR_INPUT
MSG_EVID{ // Attributes for Alarm-Properties
S7_visible:='false'; // Alarms are transferred to WinCC
S7_link:='false';
S7_param:='false';
S7_server:='alarm_archiv';
S7_a_type:='alarm_8p'
}:DWORD:=0;
SIG_1 : BOOL; // Internal Alarm Event Tag
SIG_2 : BOOL; // Internal Alarm Event Tag
SIG_3 : BOOL; // Internal Alarm Event Tag
SIG_4 : BOOL; // Internal Alarm Event Tag
SIG_5 : BOOL; // Internal Alarm Event Tag
SIG_6 : BOOL; // Internal Alarm Event Tag
SIG_7 : BOOL; // Internal Alarm Event Tag
SIG_8 : BOOL; // Internal Alarm Event Tag
BA_EN{ //Batch busy enable
S7_visible:='true'; //Parameter visible in CFC chart
S7_m_c:='false' //Parameter do not supports O&M
} : BOOL := 0;
OCCUPIED{ //Batch busy ID
S7_visible:='true'; //Parameter visible in CFC chart
S7_m_c:='false' //Parameter do not supports O&M
} : BOOL := 0;
BA_ID{ //Consequtive batch number
S7_visible:='true'; //Parameter visible in CFC chart
S7_m_c:='false' //Parameter do not supports O&M
} : DWORD;
BA_NA{ //Batch name (charge name)
S7_visible:='true'; //Parameter visible in CFC chart
S7_m_c:='false' //Parameter do not supports O&M
} : STRING[32] :='';
STEP_NO{ //Batch step number
S7_visible:='true'; //Parameter visible in CFC chart
S7_m_c:='false' //Parameter do not supports O&M
} : DWORD;
szText1{
S7_visible:='true'; //Parameter visible in CFC chart
S7_m_c:='true' //Parameter supports O&M
} : STRING[32] :=''; //user text
szText2{
S7_visible:='true'; //Parameter visible in CFC chart
S7_m_c:='true' //Parameter supports O&M
} : STRING[32] :=''; //user text
szText3{
S7_visible:='true'; //Parameter visible in CFC chart
S7_m_c:='true' //Parameter supports O&M
} : STRING[32] :=''; //user text
szText4{
S7_visible:='true'; //Parameter visible in CFC chart
S7_m_c:='true' //Parameter supports O&M
} : STRING[32] :=''; //user text
szText5{
S7_visible:='true'; //Parameter visible in CFC chart
S7_m_c:='true' //Parameter supports O&M
} : STRING[32] :=''; //user text
END_VAR
VAR_OUTPUT
MSG_STATUS :WORD;
MSG_ERROR : BOOL;
MSG_DONE : BOOL;
MSG_ACK_STATE : WORD;
END_VAR
VAR_IN_OUT
// user-specific associated message values of ALARM_8P
AUX_PR05 {S7_visible := 'false'} : ANY; //Associated value 5
AUX_PR06 {S7_visible := 'false'} : ANY; //Associated value 6
AUX_PR07 {S7_visible := 'false'} : ANY; //Associated value 7
AUX_PR08 {S7_visible := 'false'} : ANY; //Associated value 8
AUX_PR09 {S7_visible := 'false'} : ANY; //Associated value 9
AUX_PR10 {S7_visible := 'false'} : ANY; //Associated value 10
END_VAR
VAR
ALARM_8P_1:SFB35; //Multi instance call of ALARM_8P block
iERROR : INT; //used for return value of sfc call
dwFILL_ZERO :DWORD; //used for SFC "FILL"
abyBA_NA : ARRAY [1..32] OF BYTE := 16(0); //intern array of byte batch name
abyText1 : ARRAY [1..32] OF BYTE := 16(0); //intern array of byte Text4
abyText2 : ARRAY [1..32] OF BYTE := 16(0); //intern array of byte Text5
abyText3 : ARRAY [1..32] OF BYTE := 16(0); //intern array of byte Text6
abyText4 : ARRAY [1..32] OF BYTE := 16(0); //intern array of byte Text7
abyText5 : ARRAY [1..32] OF BYTE := 16(0); //intern array of byte Text8
wSTEP_NO :DWORD; //intern Batch step number
dwBA_ID :DWORD; //intern Batch ID
END_VAR

BEGIN
wSTEP_NO := STEP_NO;
dwBA_ID := BA_ID;
dwFILL_ZERO := 0;
iERROR := FILL(BVAL:=dwFILL_ZERO,BLK:= abyBA_NA); //reset complete memory
iERROR := BLKMOV(SRCBLK:=BA_NA,DSTBLK:= abyBA_NA); //copy used characters of string
iERROR := FILL(BVAL:=dwFILL_ZERO,BLK:= abyText1); //fill complete memory
iERROR := BLKMOV(SRCBLK:=szText1,DSTBLK:= abyText1); //fill complete memory
iERROR := FILL(BVAL:=dwFILL_ZERO,BLK:= abyText2); //fill complete memory
iERROR := BLKMOV(SRCBLK:=szText2,DSTBLK:= abyText2); //fill complete memory
iERROR := FILL(BVAL:=dwFILL_ZERO,BLK:= abyText3); //fill complete memory
iERROR := BLKMOV(SRCBLK:=szText3,DSTBLK:= abyText3); //fill complete memory
iERROR := FILL(BVAL:=dwFILL_ZERO,BLK:= abyText4); //fill complete memory
iERROR := BLKMOV(SRCBLK:=szText4,DSTBLK:= abyText4); //fill complete memory
iERROR := FILL(BVAL:=dwFILL_ZERO,BLK:= abyText5); //fill complete memory
iERROR := BLKMOV(SRCBLK:=szText5,DSTBLK:= abyText5); //fill complete memory
//ALARM_8P Call with parameters
//Call of instance address EEEE für ID is needed
ALARM_8P_1(EV_ID:=MSG_EVID,ID:=16#EEEE,
SIG_1:=SIG_1,
SIG_2:=SIG_2,
SIG_3:=SIG_3,
SIG_4:=SIG_4,
SIG_5:=SIG_5,
SIG_6:=SIG_6,
SIG_7:=SIG_7,
SIG_8:=SIG_8,
SD_1:=abyBA_NA,
SD_2:=wSTEP_NO,
SD_3:=dwBA_ID,
SD_4:=abyText1,
SD_5:=abyText2,
SD_6:=abyText3,
SD_7:=abyText4,
SD_8:=abyText5,
SD_9:=AUX_PR09,
SD_10:=AUX_PR10
);
MSG_STATUS := ALARM_8P_1.STATUS;
MSG_ERROR := ALARM_8P_1.ERROR;
MSG_DONE := ALARM_8P_1.DONE;
MSG_ACK_STATE := ALARM_8P_1.ACK_STATE;
END_FUNCTION_BLOCK

You might also like