Check value change in 2 integers

jovial.kj

Member
Join Date
Jan 2012
Location
Doha
Posts
6
How to check value change in 2 integers? I am using Twincat PLC control. We have setpoints coming from Workstation and HMI. I need to assign the actual setpoint which ever is updated.
 
Thank you for your supprt.. :) Is there any particular function block or logic to detect value change in an integer?
 
If setpoint neq workstation move workstation setpoint move workstation hmi

if setpoint neq hmi move hmi setpoint move hmi workstation


You also need 3rd variable for saving old copied value, otherwise network1 will always copy setpoint to hmi and copy to other way don't work

if you only code:

NW1

SP <> HMI -> HMI = SP



NW2

HMI <> SP -> SP = HMI



then PLC don't know if SP or HMI is changed last and NW1 is allways executed first.




but if we add 3rd variable

NW1

SP <> MEMORY -> HMI = SP
MEMORY=SP



NW2

HMI <> MEMORY -> SP = HMI
MEMORY=HMI




Then code will work to both ways


p.s Much easier if you use same varible address on hmi and workstation
 
Last edited:
Hi Lare, I hope you can help me out. I will describe the problem clearly below.

We one controller - one Work station - One HMI

Set point value should be stored on Controller.

If there is any change in value of HMI or WS, setpoint should update accordingly.

If HMI or WS is down, i.e., if the value is our of certain limits, setpoint will retain the initial value.

Now im looking for a logic or function block where i can detect data change in the integer
 
On workstation and on HMI make a button for updating, this way you can have three setpoints.
If button pressed the PLC should take over the according setpoint.
This will avoid racing situations.
This way you can setup a complete new setup and with the press of a button activate it.
 
I honestly don't see the issue.

Neither HMI nor Workstation should be writing the setpoint continuously. In all systems I've worked on, HMI and/or Workstation only writes to the controller the moment the variable is changed. But read the variable according to the configured update cycle.

This means you can configure both HMI and Workstation to change the exact same variable. It will automatically take the value of the latest change. And as long as neither the HMI nor the Workstation writes to it, ie. when they are down, the value of the variable shouldn't change.
 
I honestly don't see the issue.

Neither HMI nor Workstation should be writing the setpoint continuously. In all systems I've worked on, HMI and/or Workstation only writes to the controller the moment the variable is changed. But read the variable according to the configured update cycle.

This means you can configure both HMI and Workstation to change the exact same variable. It will automatically take the value of the latest change. And as long as neither the HMI nor the Workstation writes to it, ie. when they are down, the value of the variable shouldn't change.

Exactly this, but as I indicated, I'd also update the 'partner' reference based on the one that changed to keep everything in sync.
 
Hi Lare, I hope you can help me out. I will describe the problem clearly below.

We one controller - one Work station - One HMI

Set point value should be stored on Controller.

If there is any change in value of HMI or WS, setpoint should update accordingly.

If HMI or WS is down, i.e., if the value is our of certain limits, setpoint will retain the initial value.

Now im looking for a logic or function block where i can detect data change in the integer

AS Jeebs and Rdrast writed, there should not be issues, if HMI and workastation is down. Lastly writed value should keep same value in PLC, if you don't update it from PLC code or elsewhere.

Just notice, that you should (maybe) use variable that retain values even after power outage.
This depends little bit of plc used, on some PLC types you need use certain memory areas, some have settings for retaining values and so on.

And of course you can also code min/max limitations and/or give initial value for tag, if it have for example value zero...
For this all you maybe want built your own function block / POU on PLC.
There maybe isn't built in block available for this all on PLC.
 

Similar Topics

HI All.It the matter of losing the JOB. I want to write a script in Archestra or in intouch where i have to perform the Tag validation. I need...
Replies
2
Views
1,371
Hello everyone, I have a question about IFIX. there is a analog tag, its value changes every 1 sec and I need to check its value every 5 sec, if...
Replies
0
Views
1,739
Hello all, I have a Controllogix 1756-L61 with some RIO. There are a couple of 1734-OB4E's that have gone bad. (no output voltage) My boss found...
Replies
10
Views
1,056
Hello I am new here and new to PLC's, I wrote this program for a class that I am taking and my local tech school. The description is switch 7 will...
Replies
0
Views
400
Hello I am new here and new to PLC's, I wrote this program for a class that I am taking and my local tech school. The description is switch 7 will...
Replies
10
Views
1,954
Back
Top Bottom