News:

  • May 05, 2026, 08:12:30 AM

Login with username, password and session length

Author Topic: RX/WX with User Blocks  (Read 9262 times)

Tark

  • Jr. Member
  • **
  • Posts: 16
RX/WX with User Blocks
« on: November 13, 2015, 12:48:58 PM »
I see that we can perform RX/WX instructions with User Blocks by using the Block Number.  In the interest of ensuring that I am always writing to the correct User Block, I'm setting up the remote's Block Number to be the same as the remote's last digits of it's IP address.  So if the remote is 192.168.1.56 I would write to Block Number 56.  Since creating a new user block always starts at 32 and increments from there, I have been creating dummy user blocks until I get to the Block Number that I am looking for and then returning and deleting the dummy user blocks.

Is there anything wrong with creating the dummy user blocks and then deleting them?  Is there a better way to accomplish what I am doing?

HB_GUY

  • Full Member
  • ***
  • Posts: 43
Re: RX/WX with User Blocks
« Reply #1 on: November 13, 2015, 01:34:48 PM »
I think that if it were me doing the programming, I would use the same memory blocks on all the PLCs
for example
32 for string data
33 real numbers
34 for ...

I would then always know what the memory locations are for because they are in standard locations.
Then you just control what you want to talk to by its IP address and the specific type of data you are reading...

But, there are people here that have much more experience than I...
Just my $.02


Tark

  • Jr. Member
  • **
  • Posts: 16
Re: RX/WX with User Blocks
« Reply #2 on: November 13, 2015, 02:10:51 PM »
It's a Peer-To-Peer network of about 45 PLCs (when complete), so I can't use the same memory blocks in all the PLCs else everyone will be overwriting each other.  In order to keep network traffic to a minimum, I've setup a report by exception system.  PLC-1 has a Status memory block, any time the data in the Status block changes the PLC will write it's Status data to the remote PLCs that it needs to talk to.  In order to prevent overwriting errors, each PLC will always write to the same Block Number regardless of who it's talking to.  So if PLC-1's IP address is 192.168.1.56 then PLC-1 will always write to Block Number 56 in any remote PLC it writes to.  So since PLC-1 always writes to Block Number 56, then in the remotes it talks to I need to create a Block Number 56 to receive it's data.  The only way I've been able to determine accomplish this is by creating dummy memory blocks and then deleting them once I get the Block Number I'm after.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6154
  • Yes Pinky, Do-more will control the world!
Re: RX/WX with User Blocks
« Reply #3 on: November 13, 2015, 02:25:39 PM »
The block numbers are automatically assigned by the system, so yes, the only way is to pad them with dummies.

Personally, I would probably use a single block for everything and carve up the memory space instead...which is exactly what I did when I created PEERLINK. 8)
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Tark

  • Jr. Member
  • **
  • Posts: 16
Re: RX/WX with User Blocks
« Reply #4 on: November 13, 2015, 03:03:56 PM »
Personally, I would probably use a single block for everything and carve up the memory space instead...which is exactly what I did when I created PEERLINK. 8)
That's an interesting thought.  My first thought, in my case, is it might turn into an administration nightmare.  In my network a PLC will transmit it's Status block to at most three other PLCs.  To administer a single block for all 45 PLCs might be a little much, especially if something changes in the network, like a new PLC added.  Having a PLC always write to the same Block Number which is based on it's IP address seems simpler to administer at this point.  But the idea is worth giving it some more thought  ;)

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6154
  • Yes Pinky, Do-more will control the world!
Re: RX/WX with User Blocks
« Reply #5 on: November 13, 2015, 03:22:49 PM »
Block = n is not much simpler than ID = n * RecSize. The only assumption is that the records are homogeneous, but I think that is generally the situation with this type of peer network.

Another possibility would be to make one or two nodes be a master block address table manager(s), where they have a master block table containing the remote block number of each node. When a node comes on line, he writes his block number to the appropriate offset of the table. When a remote node wants to send data to a target, he checks his local copy of the table to see if the block number is set, and if not, refreshes his local copy. It's a bit more work, but would completely eliminate dependence on specific blocks. You could even extend it to handle the IP address of targets...so even that wouldn't have to be hard-coded. A small amount of indirection can go a long way.

You could wrap up the entire address resolution in a single program block, which would be run any time you want to update the local copy of the block/IP map.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO