Plc-5 2 Slot Addressing

broken image


We strongly recommend referring below post as a prerequisite of this.
Hashing | Set 1 (Introduction)
Hashing | Set 2 (Separate Chaining)

192.168.1.2 is the next address on the network which is the IP address of the PLC-5. Since the Ethernet channel is built directly into the PLC-5 this is as far as the path needs to go. Keep the default Communication Method at CIP. This means the ControlLogix will encapsulate the data into CIP packets and send it that way. Page 129 For this Field A Scan List Contains Scan rack address 1-17 octal (PLC-5/40L controllers) 1-27 octal (PLC-5/60L controllers) Starting group number 0, 2, 4, or 6 Chassis size 4-slot, 8-slot, 12-slot, 16-slot Backplane addressing 1-slot, 2-slot, or 1/2-slot Range Automatically calculated based upon rack address, starting module group. PLC-5 Controllers The PLC-5 family has been around since 1986 and was Rockwell's flagship PLC system until the late 90's. The PLC-5 is a powerful controller housed in a heavy-duty metal enclosure. It has built-in communication adapters on the controller to allow it to communicate with remote input and output modules.

Plc-5 2 Slot Addressing

Open Addressing
Like separate chaining, open addressing is a method for handling collisions. In Open Addressing, all elements are stored in the hash table itself. So at any point, the size of the table must be greater than or equal to the total number of keys (Note that we can increase table size by copying old data if needed).

Insert(k): Keep probing until an empty slot is found. Once an empty slot is found, insert k.

Search(k): Keep probing until slot's key doesn't become equal to k or an empty slot is reached.

Delete(k): Delete operation is interesting. If we simply delete a key, then the search may fail. So slots of deleted keys are marked specially as 'deleted'.
The insert can insert an item in a deleted slot, but the search doesn't stop at a deleted slot.


Open Addressing is done in the following ways:

Plc-5 2 Slot Addressing Tool

a) Linear Probing: In linear probing, we linearly probe for next slot. For example, the typical gap between two probes is 1 as taken in below example also.
let hash(x) be the slot index computed using a hash function and S be the table size

Let us consider a simple hash function as 'key mod 7' and sequence of keys as 50, 700, 76, 85, 92, 73, 101.

Challenges in Linear Probing :

  1. Primary Clustering: One of the problems with linear probing is Primary clustering, many consecutive elements form groups and it starts taking time to find a free slot or to search an element.
  2. Secondary Clustering: Secondary clustering is less severe, two records do only have the same collision chain(Probe Sequence) if their initial position is the same.

b) Quadratic Probing We look for i2‘th slot in i'th iteration.

c) Double Hashing We use another hash function hash2(x) and look for i*hash2(x) slot in i'th rotation.



See this for step by step diagrams.

Comparison of above three:
Linear probing has the best cache performance but suffers from clustering. One more advantage of Linear probing is easy to compute.
Quadratic probing lies between the two in terms of cache performance and clustering.
Double hashing has poor cache performance but no clustering. Double hashing requires more computation time as two hash functions need to be computed.

Slot

Performance of Open Addressing:
Like Chaining, the performance of hashing can be evaluated under the assumption that each key is equally likely to be hashed to any slot of the table (simple uniform hashing)

References:
http://courses.csail.mit.edu/6.006/fall11/lectures/lecture10.pdf
https://www.cse.cuhk.edu.hk/irwin.king/_media/teaching/csc2100b/tu6.pdf

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Plc-5

Open Addressing
Like separate chaining, open addressing is a method for handling collisions. In Open Addressing, all elements are stored in the hash table itself. So at any point, the size of the table must be greater than or equal to the total number of keys (Note that we can increase table size by copying old data if needed).

Insert(k): Keep probing until an empty slot is found. Once an empty slot is found, insert k.

Search(k): Keep probing until slot's key doesn't become equal to k or an empty slot is reached.

Delete(k): Delete operation is interesting. If we simply delete a key, then the search may fail. So slots of deleted keys are marked specially as 'deleted'.
The insert can insert an item in a deleted slot, but the search doesn't stop at a deleted slot.


Open Addressing is done in the following ways:

Plc-5 2 Slot Addressing Tool

a) Linear Probing: In linear probing, we linearly probe for next slot. For example, the typical gap between two probes is 1 as taken in below example also.
let hash(x) be the slot index computed using a hash function and S be the table size

Let us consider a simple hash function as 'key mod 7' and sequence of keys as 50, 700, 76, 85, 92, 73, 101.

Challenges in Linear Probing :

  1. Primary Clustering: One of the problems with linear probing is Primary clustering, many consecutive elements form groups and it starts taking time to find a free slot or to search an element.
  2. Secondary Clustering: Secondary clustering is less severe, two records do only have the same collision chain(Probe Sequence) if their initial position is the same.

b) Quadratic Probing We look for i2‘th slot in i'th iteration.

c) Double Hashing We use another hash function hash2(x) and look for i*hash2(x) slot in i'th rotation.



See this for step by step diagrams.

Comparison of above three:
Linear probing has the best cache performance but suffers from clustering. One more advantage of Linear probing is easy to compute.
Quadratic probing lies between the two in terms of cache performance and clustering.
Double hashing has poor cache performance but no clustering. Double hashing requires more computation time as two hash functions need to be computed.

Performance of Open Addressing:
Like Chaining, the performance of hashing can be evaluated under the assumption that each key is equally likely to be hashed to any slot of the table (simple uniform hashing)

References:
http://courses.csail.mit.edu/6.006/fall11/lectures/lecture10.pdf
https://www.cse.cuhk.edu.hk/irwin.king/_media/teaching/csc2100b/tu6.pdf

Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.

Attention reader! Don't stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.

Recommended Posts:

Plc 5 Slot Addressing


Improved By : PulkitGoel2, shubham_singh, himanshu_shekhar

Plc-5 2 Slot Addressing Machines






broken image