47 lines
1.6 KiB
Smalltalk
47 lines
1.6 KiB
Smalltalk
(*
|
||
===============================================================================
|
||
Project : PLC_Library
|
||
Device : -
|
||
Path : Общие
|
||
Name : CONFIRMATION
|
||
Type : FUNCTION_BLOCK
|
||
Exported : 2026-07-31 11:16:16
|
||
===============================================================================
|
||
*)
|
||
|
||
FUNCTION_BLOCK CONFIRMATION
|
||
(*
|
||
Квитирование
|
||
*)
|
||
VAR_INPUT
|
||
Alarm: BOOL; // Авария
|
||
ControlState_On: BOOL; // Управление с текущего поста
|
||
Sound_Off: BOOL; // Сигнал снятия звука
|
||
Confirmation: BOOL; // Сигнал квитирования
|
||
END_VAR
|
||
VAR_OUTPUT
|
||
Lamp_Alarm_C: WORD; // Лампа аварии
|
||
Lamp_Confirmation_C: WORD; // Лампа квитирования
|
||
Buzzer_C: WORD; // Управление звонком
|
||
END_VAR
|
||
VAR
|
||
Alarm_Not_Sound_Off: BOOL;
|
||
Alarm_Not_Confirm: BOOL;
|
||
R_TR1: R_TRIG;
|
||
R_TR2: R_TRIG;
|
||
R_TR3: R_TRIG;
|
||
END_VAR
|
||
|
||
(*----- IMPLEMENTATION -----*)
|
||
R_TR1(CLK:=Confirmation); IF R_TR1.Q THEN Alarm_Not_Confirm:=0; END_IF;
|
||
R_TR2(CLK:=Sound_Off); IF R_TR2.Q THEN Alarm_Not_Sound_Off:=0; END_IF;
|
||
R_TR3(CLK:=Alarm); IF R_TR3.Q AND ControlState_On THEN Alarm_Not_Confirm:=1; Alarm_Not_Sound_Off:=1; END_IF;
|
||
IF NOT ControlState_On THEN Alarm_Not_Confirm:=0; Alarm_Not_Sound_Off:=0; END_IF;
|
||
|
||
IF NOT Alarm AND NOT Alarm_Not_Confirm THEN Lamp_Alarm_C:=0; Lamp_Confirmation_C:=0; END_IF;
|
||
IF Alarm AND NOT Alarm_Not_Confirm THEN Lamp_Alarm_C:=1; Lamp_Confirmation_C:=0; END_IF;
|
||
IF Alarm_Not_Confirm THEN Lamp_Alarm_C:=2; Lamp_Confirmation_C:=1; END_IF;
|
||
|
||
IF Alarm_Not_Sound_Off THEN Buzzer_C:=2; ELSE Buzzer_C:=0; END_IF;
|
||
END_FUNCTION_BLOCK
|