Configuration in the straton Runtime

Previous chapterNext chapter Show allShow all    Hide allHide all

The implementation of a watchdog has to be realized as a separate main program in the language ST in straton. This program must be executed in every cycle.

PLC program code:

attention Attention

COPA-DATA or COPALP do not guarantee that the code which is mentioned here is correct. This code is only an Example.

VAR
   Temp_Mem : DINT ;
   Inst_ActiveRTSwitch : ActiveRTSwitch ;
   Temp_Count : DINT ;
   Switch_Count : DINT ;
END_VAR


(* increment watchdog *)
Watchdog_OUT += 1;

(* Watchdog_OUT is written to Watchdog_IN with an allocation in zenon
& checks whether Watchdog_IN changed since the last cycle, if
there was no change, count up cycles with no change*)
if Watchdog_IN = Temp_Mem then
Temp_Count += 1;
else
Temp_Mem := Watchdog_IN;
Temp_Count := 0;
Switch_Count := 0;
end_if;

(* reset internal status *)
Inst_ActiveRTSwitch(false);

(* Status in zenon indivates SB => redundant straton has to be connected to server
=> switch *)
if (zenonStatus = int#2) then
Inst_ActiveRTSwitch(true);
Temp_Count := 0;
end_if;

(* after 6 switches without signal from WD close both straton instances, as
zenon seems to be dead on both PCs *)
if (Switch_Count > 6) then
Terminate(true);
end_if;

(* 10 s no change of the WD zenon dead on this side => switch - with a defined cycle time of 100ms*)
if (Temp_Count > 100) then
Switch_Count += 1;
Temp_Count := 0;
Inst_ActiveRTSwitch(true);
end_if;


In the straton fieldbus configuration the straton to zenonRTconnection must be configured.

The straton project parameters (Runtime) in the zenon Properties must be defined as follows:

After the first start of the system, you can also adjust the timeout parameters of the straton Runtime. In order to do this, double-click the straton symbol in the system tray and click button Settings. Open the tab Redundancy and adjust the parameters. As a standard, we recommend a Server Timeout of 1000ms and a Client Timeout of 4000ms.