Jump to content

How does Vector:Copy handle overlapping source and destination


Recommended Posts

Hello,

I have a vector of MIs starting at MI 250, containing at most 20 elements. It is supposed to act like a FIFO buffer. There is an array of objects moving on a conveyor. Whenever an object triggers a sensor, some integer information is stored at the first available MI in the vector (there is another variable that indicates the number of elements in the vector, not especially relevant to this question). Some time later, when the same object triggers a second sensor, the data at MI250 is to be read, processed, and the vector data is shifted to the left, effectively consuming the first element. I.e. element 1 overwrites element 0, element 2 overwrites element 1, 3 overwrites 2, and so on. Can this be achieved using a Vector: Copy block, as in the attached image? Is it safe to do, am I guaranteed that the copy operation will be executed in the order I mentioned? If this is not a valid way to do what I want to do, please tell me an alternative way.

Screenshot_1.jpg

Link to comment
Share on other sites

  • MVP 2023

Yes, it is tested solution. Joe Tauser post this solution in forum topic.

I use it for select powder coating gun position when different item is moving on a conveyor and mesuring station is before powder guns.

I also manage bit vector copy for ON-OFF gun when no item is placed on conveyor.

On this screen you can see illustration of automatic program selection via bit vector copy. Green LED - conveyor sensor, Blue - item sensor.   

powder.JPG.8847cb8f1611af5c68ef6f1e73565e4d.JPG

 

Link to comment
Share on other sites

5 hours ago, Flex727 said:

If you have any Vision PLC handy, you can test this in about 2 minutes.

Unfortunately, I do not have one at hand :( And even if I did, I would not trust empirical tests like this, since they can succeed based on an undefined behavior.

Link to comment
Share on other sites

5 hours ago, kratmel said:

Yes, it is tested solution. Joe Tauser post this solution in forum topic.

I use it for select powder coating gun position when different item is moving on a conveyor and mesuring station is before powder guns.

I also manage bit vector copy for ON-OFF gun when no item is placed on conveyor.

On this screen you can see illustration of automatic program selection via bit vector copy. Green LED - conveyor sensor, Blue - item sensor.   

powder.JPG.8847cb8f1611af5c68ef6f1e73565e4d.JPG

 

Alright, thank you for your help.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...