Optimizing a network of multi-pole switches

12 Views Asked by At

I am working on designing an electrical network of multi-pole switches. Because of this, it should be possible to use the multiple poles to reduce the number of microcontroller pins that must be used, but I am having trouble figuring out how to optimize this.

I have $n$ switches with $p$ poles each, and need to be able to read $q$ switches at a time without ghosting. These switches are not perfectly reliable - when a switch is actuated some of the poles may remain disconnected. I'm currently modeling this as a guaranteed $m$ correct actuations (or a maximum of $n-m$ failed poles) per switch.

Formally, let $S_i$ represent the state of the $i$th switch, and $S_{i,j}$ the state of the $j$th pole of the $i$th switch, then

$$\forall i,j: \neg S_i \implies \neg S_{i,j}$$ $$\forall i: S_i \implies \sum_{j=1}^p \left\{\begin{matrix} 1 & S_{i,j}\\ 0 & \neg S_{i,j} \end{matrix}\right. \ge m$$

In my case I only need to consider situations where $q$ or fewer switches are on at a time, so it can be taken as a given that $$\sum_{i=1}^n \left\{\begin{matrix} 1 & S_i\\ 0 & \neg S_i \end{matrix}\right. \le q$$

I am trying to find sets of subsets $P=\{P_k:P_k \subseteq \{S_{i,j}\}\}$ with minimal $|P|$ that satisfy a few properties:

  • $\forall a,b:P_a\cap P_b = \varnothing \wedge a=b$
  • Given the values of $\vee P_k$ for all $k$, it must be possible to compute the values of each $S_i$.

One simple class of solutions is $P_i =\{S_{i,j}\forall j\}\forall i$, but this requires $|P| = n$ subsets. I am interested in configurations with minimal $|P|$, and I am sure that it's possible to do better than $n$.

In my specific case I'm working on right now, $n=17$, $p=7$, $m=5$, and $q=2$, but these are very likely going to change, so more general solutions are better. Solutions that disregard $m$ (taking $m=p$) are also of interest.