You are not registered yet. Please click here to register!


 
 
plc storereviewsdownloads
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc.
 
Try our online PLC Simulator- FREE.  Click here now to try it.

---------->>>>>Get FREE PLC Programming Tips

New Here? Please read this important info!!!


Go Back   PLCS.net - Interactive Q & A > PLCS.net - Interactive Q & A > LIVE PLC Questions And Answers

PLC training tools sale

Reply
Thread Tools Display Modes
Unread October 8th, 2019, 03:19 PM   #1
TheWaterboy
Lifetime Supporting Member + Moderator
United States

TheWaterboy is offline
 
TheWaterboy's Avatar
 
Join Date: May 2006
Location: State of Denial
Posts: 929
How to change setpoints from 2 locations over telemetry

I'm sure this has been done but I keep tripping over myself.

You have a home location and a field location that are connected via polling radio telemetry.

How can I set up PLC code so that I can change a setpoint from either location? And how do you determine which one wins if both are changed at the same time?

I have bounced off this "2 Generals" problem and have not been happy with any work I have done on it.

Can someone share a flowchart or pseudo code or even just describe how to do this?
  Reply With Quote
Unread October 8th, 2019, 03:45 PM   #2
ndzied1
Lifetime Supporting Member
United States

ndzied1 is offline
 
ndzied1's Avatar
 
Join Date: Aug 2002
Location: Chicago, Illinois
Posts: 2,451
This is pretty simplistic but it gets the point across. If the values are noisy, you'll need to set some change threshold before letting the new value take over.

If the output can't jump instantaneously, you'll have to add some ramping.

Enjoy:
https://youtu.be/5ReYA7-DmeA
__________________
nOrM
======================
nOrM=Norman Dziedzic Jr.
I've never been to China but my phone has.
  Reply With Quote
Unread October 8th, 2019, 04:32 PM   #3
OkiePC
Lifetime Supporting Member
United States

OkiePC is offline
 
OkiePC's Avatar
 
Join Date: Mar 2005
Location: ENE of Nowhere Oklahoma
Posts: 10,273
I will have all the data that goes over the radio link in one big block. Some of the data is setpoints, other is just information going from point A to B.

The part of that block of data that is setpoints has an incoming and outgoing copy. The remote stations always work with (and write to) the outgoing data.

The incoming data is scanned for changes, and if an element of the incoming data is changed, I make a copy of it in a "handshake" file, and also copy it to the outgoing (working) data. I do this in a subroutine with a loop with indirect addressing so that it reduces the chance of a typo and I only call this subroutine when I know I have received data from the master PLC.

To know when I have received data from the master, I typically use the first setpoint as a "heartbeat" register and have logic that runs every scan comparing it to its handshake register. If it changes, I latch a bit, and reset the comms timeout alarm delay timer.

The bit that I latch will call the subroutine where the rest of the setpoints are checked for changes, the outgoing file gets updated and after the loop completes its cycle through the range I need covered, I unlatch that bit so I don't keep calling this routine unnecessarily.

In the master PLC, the same principle is applied. The outgoing data is considered to be the "live", active data used on its HMI and for control purposes, and changes are made to that outgoing data. The incoming data is checked against handshake registers (one for each setpoint) and if differences occur, the new value is written to both the handshake element and the outgoing register. Like in the remotes, I only run these checks when I know that the message has completed successfully, except here, I will ensure that both write and read messages are completed by looking at the MSG DN bits (not just the heartbeat transition).

The reason for this (as I am sure you are aware) is that radio telemetry is never 100%, so if for example, the master changes setpoint A from 0 to 1, and then the data gets sent. The remote receives it, updates its outgoing data, but the master fails trying to read it. Nothing is wrong yet, until it is changed again and the message succeeds, or if the write message fails on the next cycle after a subsequent change. Like you, I have shot holes in a handful of schemes and evolved my method to this point.

It is still not perfect. It is possible to get into a race situation when operators change the same setpoint at both master and remote and the polling happens to be in between the reading and writing, and the right combination of messages don't succeed. But this method has resolved the race condition more than 98% of the time for me. The big drawback is having to have basically three copies of each setpoint. I recently did a system with 15 remote sites, 9 of which needed remote setpoint controls, with about 20 setpoints at each of those sites. That ended up using a large percentage of the available space in a Micrologix 1400 acting as the master.

Having written all this out, I am not sure if I conveyed it well enough...
__________________
It's not all the variables I am most concerned with, it's the undiscovered constants.

Last edited by OkiePC; October 8th, 2019 at 04:40 PM.
  Reply With Quote
Unread October 9th, 2019, 08:15 PM   #4
TheWaterboy
Lifetime Supporting Member + Moderator
United States

TheWaterboy is offline
 
TheWaterboy's Avatar
 
Join Date: May 2006
Location: State of Denial
Posts: 929
How funny - the first one was an actual 2 generals problem... Nice. It does have the problem of not updating both sides so each sees the others changes.

Okie
You are on the same path I am... a big block with part of it being monitored for changes. what a mess eh? But you have some additional checking that I'll look into. A race condition is pretty unlikely in my case, just have to do the best we can. Thanks to you both, I'll chew on this for a bit. I'll post my solution and see if you can poke holes in it.
  Reply With Quote
Unread October 10th, 2019, 03:55 AM   #5
rdrast
Lifetime Supporting Member
United States

rdrast is offline
 
rdrast's Avatar
 
Join Date: Apr 2003
Location: South Carolina Lowcountry
Posts: 5,401
I had a customer once that wanted line speed control via single-turn pots.... the trick was, any of 8 pots could be used to control the speed.


My solution was to just monitor each pot, and if any one made a 10% change, latch that one as the speed source.


Worked great, and it was a suprisingly friendly, intuitive control system for the operators.
__________________
------------------------------------
How to ask questions the SMART Way!

Look First, Ask Second!

  Reply With Quote
Unread October 10th, 2019, 09:25 AM   #6
ndzied1
Lifetime Supporting Member
United States

ndzied1 is offline
 
ndzied1's Avatar
 
Join Date: Aug 2002
Location: Chicago, Illinois
Posts: 2,451
I like the 8 pots version solution. ...

https://youtu.be/2a6B0wA6tFc
__________________
nOrM
======================
nOrM=Norman Dziedzic Jr.
I've never been to China but my phone has.
  Reply With Quote
Unread October 10th, 2019, 05:28 PM   #7
TheWaterboy
Lifetime Supporting Member + Moderator
United States

TheWaterboy is offline
 
TheWaterboy's Avatar
 
Join Date: May 2006
Location: State of Denial
Posts: 929
Yea, but still not ideal from a user perspective. Sliders in different physical positions... But still very interesting.

Whats the ??? doing in this?
8 generals.jpg
  Reply With Quote
Unread October 10th, 2019, 05:40 PM   #8
ndzied1
Lifetime Supporting Member
United States

ndzied1 is offline
 
ndzied1's Avatar
 
Join Date: Aug 2002
Location: Chicago, Illinois
Posts: 2,451
That is the down side of using FOR loops. At the end of the FOR loop, the value of i is actually 8. But the array only has values from [0..7] so the value with a callout of 8 is undefined.

And damn you, you had to keep harping on the sliders.... ;-)

https://youtu.be/_yTkMvyEWPY
__________________
nOrM
======================
nOrM=Norman Dziedzic Jr.
I've never been to China but my phone has.
  Reply With Quote
Unread October 10th, 2019, 05:41 PM   #9
ndzied1
Lifetime Supporting Member
United States

ndzied1 is offline
 
ndzied1's Avatar
 
Join Date: Aug 2002
Location: Chicago, Illinois
Posts: 2,451
The Tags in the project are:

Code:
PROGRAM PLC_PRG
VAR
	rCMD:		ARRAY[0..7] OF REAL;
	rWAS:		ARRAY[0..7] OF REAL;
	bLight:		ARRAY[0..7] OF BOOL;
	i:		INT;
	iGeneral:	INT;
	iGenDisp:	INT;
	rTemp:		REAL;
	rSET:		REAL;
	Smooth:		RAMP_REAL;
END_VAR
__________________
nOrM
======================
nOrM=Norman Dziedzic Jr.
I've never been to China but my phone has.
  Reply With Quote
Unread October 11th, 2019, 09:51 AM   #10
ndzied1
Lifetime Supporting Member
United States

ndzied1 is offline
 
ndzied1's Avatar
 
Join Date: Aug 2002
Location: Chicago, Illinois
Posts: 2,451
BTY, in my code, the "general" with the highest number station wins any races.

So if 4 and 6 go over the 10% threshold which I set up during the same PLC scan, 6 will "win" and take control. At least that seems like what will happen. Testing is left as an exercise for the student.
__________________
nOrM
======================
nOrM=Norman Dziedzic Jr.
I've never been to China but my phone has.
  Reply With Quote
Unread October 11th, 2019, 06:12 PM   #11
TheWaterboy
Lifetime Supporting Member + Moderator
United States

TheWaterboy is offline
 
TheWaterboy's Avatar
 
Join Date: May 2006
Location: State of Denial
Posts: 929
Quote:
And damn you, you had to keep harping on the sliders.... ;-)
LOL, but look at the magic you created...

Thanks Norm - this looks like fun - Ill try it over slow telemetry and see how that works.
  Reply With Quote
Unread October 14th, 2019, 02:46 PM   #12
Lare
Member
Finland

Lare is offline
 
Join Date: Jan 2006
Location: Finland
Posts: 1,166
Quote:
Originally Posted by TheWaterboy View Post
I'm sure this has been done but I keep tripping over myself.

You have a home location and a field location that are connected via polling radio telemetry.

How can I set up PLC code so that I can change a setpoint from either location? And how do you determine which one wins if both are changed at the same time?

I have bounced off this "2 Generals" problem and have not been happy with any work I have done on it.

Can someone share a flowchart or pseudo code or even just describe how to do this?

As Okie Writed.



On master side you need to latch bit, if setpoints are changed from last remote writing.


Then on communication, you need first to read from remote side to buffer, if setpoint latch bit isn't setted on master side. (Remote and master equals, or remote side have newr data, but you can't know before you read remote)


Compare readed data to master, and copy from remote to master, if remote side have different data.


If latch bit is on, then you need to write to remote side, since master have "newest" setpoints.


After all, you have 3 variables for every setpoint.
Master SP, remote SP and buffer, which is used to comparing. Then you only need to move commands between them.
  Reply With Quote
Unread October 15th, 2019, 08:07 AM   #13
kvogel
Member
United States

kvogel is offline
 
Join Date: Jan 2011
Location: Colorado
Posts: 89
Quote:
Originally Posted by rdrast View Post
I had a customer once that wanted line speed control via single-turn pots.... the trick was, any of 8 pots could be used to control the speed.


My solution was to just monitor each pot, and if any one made a 10% change, latch that one as the speed source.


Worked great, and it was a suprisingly friendly, intuitive control system for the operators.
Monitoring the amount of change at each pot and adding or subtracting the change from the setpoint would have worked and not had the limitation of the 10% threshold. ie: Don't use the actual position of pot as the speed source, use only the change in position to alter the setpoint. Obviously without knowing the entire criteria this may or may not be an appropriate solution and it's dependent on the hardware as well. The point where the signal "wraps" would need to be clean and accounted for.

Cheers

Ken

Last edited by kvogel; October 15th, 2019 at 08:10 AM.
  Reply With Quote
Unread October 15th, 2019, 09:52 AM   #14
ndzied1
Lifetime Supporting Member
United States

ndzied1 is offline
 
ndzied1's Avatar
 
Join Date: Aug 2002
Location: Chicago, Illinois
Posts: 2,451
Quote:
Originally Posted by kvogel View Post
The point where the signal "wraps" would need to be clean and accounted for.

Cheers

Ken
This would be easy if instead of resistive pots you had full 360 degree low resolution encoders (like on the volume control of most car radios) instead of pots. It's darn hard to find something like this that is not very expensive. it would burn 2 digital inputs for the A&B channels but would make stuff like this very easy.
__________________
nOrM
======================
nOrM=Norman Dziedzic Jr.
I've never been to China but my phone has.
  Reply With Quote
Reply
Jump to Live PLC Question and Answer Forum

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Topics
Thread Thread Starter Forum Replies Last Post
Detect change in any element of UDT ASF LIVE PLC Questions And Answers 15 April 28th, 2016 10:55 AM
GE QuickPanel IP Address Change PLCPRO1 LIVE PLC Questions And Answers 1 April 20th, 2016 12:41 PM
PanelView Plus 7 Screen Change = Bit change? _Dock_ LIVE PLC Questions And Answers 3 October 13th, 2015 04:55 PM
Factorytalk view password reset button problem Nan LIVE PLC Questions And Answers 6 September 29th, 2015 01:16 PM
S7-413 wont change MPI adress. JesperMP LIVE PLC Questions And Answers 6 May 21st, 2003 04:02 PM


All times are GMT -5. The time now is 12:20 AM.


.