What is this technic called?

TheStarr

Member
Join Date
Jan 2009
Location
Florida
Posts
383
We use a programming technic to combine multiple inspection results into a single number. Now we need to define this process in a spec for a new machine but don't know what to call it. I have scoured the internet and found zero leads.

Any idea what it is called?

Example:

Pass = 1
Fail = 0

Insp 1 = 1 x 1 = 1
Insp 2 = 1 x 2 = 2
Insp 3 = 0 x 4 = 0
Insp 4 = 1 x 8 = 8
Insp 5 = 0 x 16 = 0
Insp 6 = 1 x 32 = 32
Total of all results = 43 (1+2+8+32)

A pass would be = 63 (1+2+4+8+16+32)

Using the result (43) and some math I can go back and figure out which inspections passed and which ones failed.

The advantage is that I only have to use one column in my SQL table to represent as many inspections as I want.

So it is kind of like a binary factorial, or binary encoding, or binary checksum, but none of those bring up the clean definition I am looking to provide the integrator.

Any ideas? Thanks, Marshall.
 
Its called a Hash function. You publish the function algorithm with the spec.

All you are really doing with your hash function is setting the binary bits in a word (binary encoding), each bit corresponds to an inspector. In your example, the value 43 in binary is

0000 0000 0010 1011,

bits 0, 1, 3, and 5 are all set, and 2^0 + 2^1 + 2^3 + 2^5 = 43.
 
Last edited:
Do you do the hash in a PLC or in another computer.

If it is in the PLC then you don't really need any math.


Inspector1Pass DINTTAG.0
--][----------------------( )--

Inspector2Pass DINTTAG.1
--][----------------------( )--

Inspector3Pass DINTTAG.2
--][----------------------( )--

Inspector4Pass DINTTAG.3
--][----------------------( )--

 
It is done in a Cognex camera. The value, along with other data, is sent via ethernet using an I/O assembly loaded as a "generic ethernet" module to the PLC. An external VB program using InGear pulls the data and stores it in the SQL table.
 
Oh yeah, the math part...

I use SQL studio and send the value to a stored procedure I wrote that parses the number and uses a lookup table to display the results in a report.
 
Here is the "math" logic from the example:
Result was 43. I know that the highest modifier is 32.

Is 43 >= 32? Yes, Insp 6 passed, so 43 - 32 = 11
Is 11 >= 16? No, Insp 5 failed, so 11 = 11
Is 11 >= 8? Yes, Insp 4 passed, so 11 - 8 = 3
Is 3 >= 4? No, Insp 3 failed, so 3 = 3
Is 3 >= 2? Yes, Insp 2 passed, so 3 - 2 = 1
Is 1 >= 1? Yes, Insp 1 passed

There you go, easy.
 
All you are really doing with your hash function is setting the binary bits in a word (binary encoding), each bit corresponds to an inspector.

Never thought of it that way. Cool! Watch out world, a little knowledge is dangerous!
 
I never knew what Hash function meant.

I have always called it bit packing when multiple values are encoded this way, and binary encoding when they are all related and of the same weight.

I had to learn how to do this back when I was 14 programming the Atari400 in order to create a maze/adventure game with 16K of ram. I already had four character sets to animate walls and doors, fire and bullets flying and such, and the gameplay joystick stuff was done, but I only had 100 rooms and was running out of RAM. When I tried to add the 3rd dimension to my array it errored.

I wanted a 10 story building with up to 100 rooms or hallways per floor (10 x 10). Plus, I had story-boarded about twenty differnet hidden keys, obstacles, etc, so I bit packed the representation of each room and "enemy" or "treasure" from my paper drawings into what eventually became ASCII (technically, it was ATASCII) strings so I could put them into nice little compact Atari DATA statements.

My brother was addicted to that game, and he got really p-Oh'd when the power blipped and he had to reload from cassette after having it halfway solved.
 
Last edited:

Similar Topics

We have some of these that are obsolete. Trying to get a better understanding of how they work and how to test them. Is there anyone familiar with...
Replies
0
Views
1,342
Having trouble finding any info on this. I believe it works similar to a Compumotor. Based on inputs and how programmed is what it responds to...
Replies
6
Views
2,600
Anyone heard of Griffin Technics in Lodi NJ ? They make (or made) Ozone Generating equipment and seem to have dissappeared off the face of the...
Replies
2
Views
1,954
hi everyone i have this simple program using HSC i set the NEW_RV to 1000 when rotating the encoder and when reaching 1000 the counting restart...
Replies
3
Views
1,568
An Airbus 380 is on its way across the Atlantic. It flies at 800 km/h in 30,000 feet . Suddenly a Eurofighter with Tempo Mach 2 appears. The pilot...
Replies
5
Views
2,407
Back
Top Bottom