Machine Automation Forum
A forum addressing machine automation solutions for the complete machine lifecycle. Including offers like Machine Advisor, Modicon PLC/PacDrive, Lexium or Preventa. Discuss and share knowledge on offers relating to cloud-based service platforms, machine localization and monitoring, industrial operations control, motion products as well as safety function!
Link copied. Please paste this link to share this article on your social media post.
Posted: 2023-01-17 08:29 AM
So, after being able to establish a communication between two PLC´s I can see the information I need exchanged. However if the PLC communication is lost, the value of the variables as reflected on the other PLC is not updated. I guess there must be a very good reason why this works like this.
I´ve been told to generate a square wave pulse on each end and verify if this pulse changes on the other end. If you do not see a change after a while then it means communication is lost.
So my question is: is there any available FB to check this ? The sysCanopenNodeStatus is only for Master-Slave communication ? What is the easiest way to implement this?
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2023-01-17 09:12 AM
sysCanOpenNodeStatus is related to Can master, when you use binding none of the PLC is configured as master.
My suggestion is to assign to a status variable sysTimer/1000 and assign it via binding to uiSysTimerSec.
Try in the PLC which is reading this value something like that:
ToffComOk(in:=uiSysTimerSec_old <> uiSysTimerSec, pt:=ALARMTIMEOUT);
xComAlarm:=NOT(ToffComOk.q);
uiSysTimerSec_old := uiSysTimerSec;
You can do this on each PLC which is reading data.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2023-01-17 09:12 AM
sysCanOpenNodeStatus is related to Can master, when you use binding none of the PLC is configured as master.
My suggestion is to assign to a status variable sysTimer/1000 and assign it via binding to uiSysTimerSec.
Try in the PLC which is reading this value something like that:
ToffComOk(in:=uiSysTimerSec_old <> uiSysTimerSec, pt:=ALARMTIMEOUT);
xComAlarm:=NOT(ToffComOk.q);
uiSysTimerSec_old := uiSysTimerSec;
You can do this on each PLC which is reading data.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2023-01-18 12:27 PM
Thank you. I ended up generating a FB so that I do not need to think this over again in the future. It is not exactly the same (I had to use a TON timer instead of a TOFF) but it is basically the same. Here is the code:
FUNCTION_BLOCK CanCheck
VAR
TonComOk : TON;
uiSavedSeconds : UINT; (* auxiliary variable to store input *)
END_VAR
VAR_INPUT
uiseconds : UINT := 0; (* Input in seconds *)
usialarmtime : USINT;
END_VAR
(***************************************************************************************
Verify can communication
Author: JMT based on Federico Marcassa idea
Date: 17-Jan-2023
Use:
1) Generate two status variable type UINT. One will be assigned to generate a sync variable that
will be read form the second PLC by binding. The other variable must be the input to this FB
(read by binding from the second PLC)
2) If the input stays the same for more than the time specified in usiAlarmTime (in seconds)
alarm output will turn ON
***************************************************************************************)
TonComOk(PT := TO_UDINT(usialarmtime) * 1000);// alarm time in seconds
uiSyncSeconds := TO_UINT(sysTimer / 1000); // Generate sync variable. It adds 1 every second.
IF uiSavedSeconds = uiSeconds THEN //If the value stays the same communication is lost
TonComOk(IN:= TRUE);
ELSE //If it changes, communication is ok
TonComOk(IN:= FALSE);
uiSavedSeconds := uiSeconds ;
END_IF;
xComAlarm:=TonComOk.q; //if time elapses we generate a communication alarm
Link copied. Please paste this link to share this article on your social media post.
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.