Choose Language Hide Translation Bar
Staff
Which switch is which? Exploring light switches and circuit breakers with covering arrays

When my wife and I moved into our house, one of my first tasks was to swap the old light switches with new ones in frequently used rooms. Once I figured out how it was done, it seemed simple enough: Go to the circuit box, switch the circuit breaker off for that particular room and replace the switches.

Everything seemed fine, until I made a shocking discovery that one of the switches (we weren’t sure what it controlled) still had power running to it after switching off the breaker to that room. I went right to the store to get a circuit tester ... but that switch still needed to be replaced. I could turn off all 30 breakers at once, but I really was curious as to which breaker controls that switch.

So now what?

The simplest approach would seem to be to try one circuit at a time, until I could figure out which circuit controls the switch. Of course, the switch and outlet are on different floors, so this still seems tedious. If I get lucky, I turn off the right circuit immediately. But if I’m unlucky, 30 circuits means many trips up and down the stairs.

A binary search?

I could do a binary search with half the circuits on and half of them off, figure out which group the switch belongs to, and repeat this process until I get down to one switch. However, a quick Internet search reveals that there’s a possibility two circuits need to be set to off so I can finally switch that switch. The one-at-a-time method won't even help me with this.

I’m confident I only need to turn off one circuit, but what if it’s not the case? This sounds like I could do a designed experiment, but I don’t have the typical notion of random noise, and my response is essentially binary (power to the switch or not). What I really want is a design with these features:

• If it is just one circuit, tell me exactly which one it is.
• If it is two circuits, give me some direction through knowing I’ve seen a case with both breakers off (and not all switches off, which isn’t particularly helpful).
• Achieve the first two points in as few tests as possible.
• It turns out, I can do this with only eight tests, where each run/test has some of the switches on, and some of them off.

How?

At Discovery Summit 2014, John Sall’s plenary talk showed a preview of some of the fantastic new features coming out in JMP 12 next March. My personal favorite is the new JMP Pro 12 platform in DOE for covering arrays, implemented by Joseph Morgan, the newest member of the DOE development team.

A covering array?

For a strength t covering array, given any t columns, every possible level combination occurs at least once. For example, for a 2-covering array that has column (factor) A with levels A1 and A2, and column B with levels B1 and B2, each of the pairs (A1, B1), (A1, B2), (A2, B1), (A2, B2) would have to appear in the design.

So, if I had a strength 2 covering array where the factors represent the switches with levels on/off, I know that for any pair of switches, somewhere in the experiment I’ve seen both switches on, one on and one off, and both off.

For those familiar with DOE, this might sound similar to the definition for an orthogonal array. The key difference is that an orthogonal array requires each combination to occur exactly the same number of times, while a covering array just requires that each combination occurs. As it turns out, if I have 30 factors, X1-X30, representing the circuits with settings on/off, the smallest strength 2 covering array has a mere eight runs. For this particular case, the first test has all switches set to “on,” so I would really need only seven tests. An orthogonal array for this case would require 32 runs.

Covering arrays are frequently used in software testing, where they help to ensure there are no software faults due to t-way combinations of factors. Covering arrays help achieve this at a fraction of the cost of exhaustive testing. Covering arrays have been used to test parts of JMP as far back as 2006.

How does it work in this case?

Let’s say that I have the eight-run strength 2 covering array, and recorded whether or not the switch had electricity for each run. I’m only showing the first few factors in the figure below, but my actual data table goes to X30.

This is just a preview of what’s to come in JMP 12, but in this example, I can tell that circuit X1 is the culprit. The light switch always works when X1 is on and does not when X1 is off. This is not the case for any other breakers. Not only can I now change the switch, I’ve solved the mystery of which circuit actually controls it.

Final thoughts

In this example, a few extra trips up the stairs may not seem like a big deal, but you can imagine examples where a test can be a very expensive, so every run saved makes a big difference. Particularly as the number of factors grows, there are far too many possibilities you can miss if you do not have access to software for covering arrays. What if I had many more switches, say 100, 200 or 500? You might think that a covering array would get too large to deal with. The run size for the above cases are 10, 11, and 13 respectively – amazing!

You can look forward to more on covering arrays when JMP 12 is released next March!

Article Labels

There are no labels assigned to this post.

Article Tags
Visitor

Teresa Obis wrote:

Hy Ryan,

I am not an expert in Cover Array, but it seems that this is the same that Stephen Mistler use to solve Sudoku in the SAS Training Post (find link above).

Is that true? If yes, how can we solve a Sudoku with JSL? That would be nice. Can you help me.

http://blogs.sas.com/content/sastraining/2015/02/05/solving-sudoku-with-sasiml-part-2/?utm_source=fe...

Staff

Ryan Lekivetz wrote:

Similar sounding names, but the exact cover matrix has a very special form.

However, there is an add-in on the JMP community - https://community.jmp.com/docs/DOC-6092 (and the original blog here http://blogs.sas.com/content/jmp/2011/12/21/sudoku-and-jmp-a-holiday-gift-for-you/ ).

Cheers,

Ryan