dweisser
Member
Hello,
I am in need of a solution to a problem I've failed to come up with a solution to that doesn't take entirely too long for my needs.
I have a light curtain with 360 points, what I want to do is count the number of objects which take up at least (x) number of said points, and not count anything smaller then that, and get a total number of objects passing through simultaneously.
If I were writing it as a while loop it'd be relatively simple, but I don't have the ability to do that without an additional software package.
Relying on each scan to implement a pseudo-while loop would result in 360 scans before completion, which could be up to a few seconds.
What I need to do is check each of the 360 bits, and see how many consecutive bits are TRUE, and then count each one above a certain threshold. A photoeye is triggered to take the snapshot of the state when I want to count.
For example, if the bit pattern looked like this, 0100 1001 0111 1 0001 1111 0001 1111 0010(completely made up), and my threshold were 4, I would want my result to be 3. Because 3 times in that made up word, were 4 bits in a row "true". With a small word like this, it's easy to do brute forced, but scaling it up to 360 bits ( about 22 and a half words), brute forcing this could get extremely ugly, especially considering you'd need to account for words overlapping (ie, word 1 ends in 0001, word two begins with 1110, that should count as 1)
I'm racking my brain here and feel like I'm missing something obvious
I am in need of a solution to a problem I've failed to come up with a solution to that doesn't take entirely too long for my needs.
I have a light curtain with 360 points, what I want to do is count the number of objects which take up at least (x) number of said points, and not count anything smaller then that, and get a total number of objects passing through simultaneously.
If I were writing it as a while loop it'd be relatively simple, but I don't have the ability to do that without an additional software package.
Relying on each scan to implement a pseudo-while loop would result in 360 scans before completion, which could be up to a few seconds.
What I need to do is check each of the 360 bits, and see how many consecutive bits are TRUE, and then count each one above a certain threshold. A photoeye is triggered to take the snapshot of the state when I want to count.
For example, if the bit pattern looked like this, 0100 1001 0111 1 0001 1111 0001 1111 0010(completely made up), and my threshold were 4, I would want my result to be 3. Because 3 times in that made up word, were 4 bits in a row "true". With a small word like this, it's easy to do brute forced, but scaling it up to 360 bits ( about 22 and a half words), brute forcing this could get extremely ugly, especially considering you'd need to account for words overlapping (ie, word 1 ends in 0001, word two begins with 1110, that should count as 1)
I'm racking my brain here and feel like I'm missing something obvious