{"id":16958,"date":"2023-12-18T20:22:35","date_gmt":"2023-12-18T20:22:35","guid":{"rendered":"https:\/\/www.dmcinfo.com\/blog\/16958\/using-algorithms-for-efficient-multiplexing\/"},"modified":"2025-12-23T09:46:53","modified_gmt":"2025-12-23T14:46:53","slug":"using-algorithms-for-efficient-multiplexing","status":"publish","type":"post","link":"https:\/\/www.dmcinfo.com\/blog\/16958\/using-algorithms-for-efficient-multiplexing\/","title":{"rendered":"Using Algorithms for Efficient Multiplexing"},"content":{"rendered":"\n<p>In <a href=\"https:\/\/www.dmcinfo.com\/services\/test-and-measurement-automation\">Test and Measurement Automation<\/a> projects, we often have to make numerous, quick measurements for test points on a device being tested, which we make with multiplexers. For a recent project, we needed to measure multiple AC voltages on a&nbsp;<a href=\"https:\/\/www.dmcinfo.com\/latest-thinking\/case-studies\/view\/id\/641\/automated-testing-of-a-mobile-energy-storage-system\">Mobile Energy Storage System<\/a>.<\/p>\n\n\n\n<p>We chose multiplexers that are rated for high voltages, can carry a decent amount current, and are rated by their manufacturer to have their relays switched on and off plenty of times. These are mechanical systems, however, and, if you build enough test systems with multiplexers that constantly switch relays on and off, one of them will eventually fail. Any part of a factory line system failing means downtime, which can lead&nbsp;to losses.<\/p>\n\n\n\n<p>The best approach to test systems that last and deliver value is to expect that they may fail at some point. At DMC, we design tools to delay and diagnose the inevitable as opposed to ignoring it.<\/p>\n\n\n\n<p>To this end, we deployed our project with a diagnostic sequence and additional hardware that the client&nbsp;could use&nbsp;periodically to detect wiring and relay faults so we can fix them. There are several&nbsp;ways in which this idea can be applied.<\/p>\n\n\n\n<p>Take the example of testing a standard 120V AC outlet: we need to check that we see ~120V between live and neutral as well as live and ground but ~0V between neutral and ground.<br>\n&nbsp;<br>\nIn our case, we mapped DMM and each of the test points to multiplexer coordinate \u201cpaths\u201d and those paths to human-readable names through our custom \u201cMUX Manager\u201d library. This enabled us to control relays with Python lines like these:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(1 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e\"><span style=\"background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e\">Python<\/span><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>\nmux_manager.get_pin_path(&lt;Pin Name>, &lt;Rail>)\n\nmux_manager.set_pin(&lt;Pin Path>, &lt;New State>)\n\nmux_manager.read_pin(&lt;Pin Path>)\n\nmux_manager.clear_all()<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">mux_manager.get_pin_path(&lt;Pin Name&gt;, &lt;Rail&gt;)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">mux_manager.set_pin(&lt;Pin Path&gt;, &lt;New State&gt;)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">mux_manager.read_pin(&lt;Pin Path&gt;)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">mux_manager.clear_all()<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>If we wrote a generic method in a test class to measure the voltage between two pins, a first attempt would look something like this:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e\"><span style=\"background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e\">Python<\/span><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>\n class VoltageTest:\n\u00a0 \u00a0 \u2026\n\n\u00a0 \u00a0 def test_voltage(self, pin_a, pin_b, expected, tolerance):\u00a0\n\n\u00a0 \u00a0 \u00a0 \u00a0 self.mux_manager.clear_all()\n\n\u00a0 \u00a0 \u00a0 \u00a0 path_a = self.mux_manager.get_pin_path(pin_a, Rail.POSITIVE)\u00a0\n\n\u00a0 \u00a0 \u00a0 \u00a0 path_b = self.mux_manager.get_pin_path(pin_b, Rail.NEGATIVE)\u00a0\n\n\u00a0\n\n\u00a0 \u00a0 \u00a0 \u00a0 self.mux_manager.set_pin(path_a, True)\u00a0\n\n\u00a0 \u00a0 \u00a0 \u00a0 self.mux_manager.set_pin(self.dmm_positive_path, True)\u00a0\n\n\u00a0 \u00a0 \u00a0 \u00a0 self.mux_manager.set_pin(path_b, True)\u00a0\n\n\u00a0 \u00a0 \u00a0 \u00a0 self.mux_manager.set_pin(self.dmm_negative_path, True)\u00a0\n\n\u00a0 \u00a0 \u00a0 \u00a0 measurement = self.dmm.read_voltage()\n\n\u00a0 \u00a0 \u00a0 \u00a0 # Clearing up connections\n\n\u00a0 \u00a0 \u00a0 \u00a0 self.mux_manager.clear_all()\n\n\u00a0 \u00a0 \u00a0 \u00a0 if (expected - tolerance) &lt; measurement &lt; (expected + tolerance):\u00a0\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 return \"PASS\"\n\n\u00a0 \u00a0 \u00a0 \u00a0 else:\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 return \"FAIL\"<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">class<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">VoltageTest<\/span><span style=\"color: #D4D4D4\">:<\/span><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u2026<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 <\/span><span style=\"color: #569CD6\">def<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">test_voltage<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">self<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #9CDCFE\">pin_a<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #9CDCFE\">pin_b<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #9CDCFE\">expected<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #9CDCFE\">tolerance<\/span><span style=\"color: #D4D4D4\">):\u00a0<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"color: #569CD6\">self<\/span><span style=\"color: #D4D4D4\">.mux_manager.clear_all()<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 path_a = <\/span><span style=\"color: #569CD6\">self<\/span><span style=\"color: #D4D4D4\">.mux_manager.get_pin_path(pin_a, Rail.POSITIVE)\u00a0<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 path_b = <\/span><span style=\"color: #569CD6\">self<\/span><span style=\"color: #D4D4D4\">.mux_manager.get_pin_path(pin_b, Rail.NEGATIVE)\u00a0<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"color: #569CD6\">self<\/span><span style=\"color: #D4D4D4\">.mux_manager.set_pin(path_a, <\/span><span style=\"color: #569CD6\">True<\/span><span style=\"color: #D4D4D4\">)\u00a0<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"color: #569CD6\">self<\/span><span style=\"color: #D4D4D4\">.mux_manager.set_pin(<\/span><span style=\"color: #569CD6\">self<\/span><span style=\"color: #D4D4D4\">.dmm_positive_path, <\/span><span style=\"color: #569CD6\">True<\/span><span style=\"color: #D4D4D4\">)\u00a0<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"color: #569CD6\">self<\/span><span style=\"color: #D4D4D4\">.mux_manager.set_pin(path_b, <\/span><span style=\"color: #569CD6\">True<\/span><span style=\"color: #D4D4D4\">)\u00a0<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"color: #569CD6\">self<\/span><span style=\"color: #D4D4D4\">.mux_manager.set_pin(<\/span><span style=\"color: #569CD6\">self<\/span><span style=\"color: #D4D4D4\">.dmm_negative_path, <\/span><span style=\"color: #569CD6\">True<\/span><span style=\"color: #D4D4D4\">)\u00a0<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 measurement = <\/span><span style=\"color: #569CD6\">self<\/span><span style=\"color: #D4D4D4\">.dmm.read_voltage()<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"color: #6A9955\"># Clearing up connections<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"color: #569CD6\">self<\/span><span style=\"color: #D4D4D4\">.mux_manager.clear_all()<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> (expected - tolerance) &lt; measurement &lt; (expected + tolerance):\u00a0<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"color: #C586C0\">return<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&quot;PASS&quot;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"color: #C586C0\">else<\/span><span style=\"color: #D4D4D4\">:<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"color: #C586C0\">return<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&quot;FAIL&quot;<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>We need to clear up the connections at the end of each function call to leave the multiplexer in a clean state so that calls to test_voltage can be rearranged in a test sequence by an engineer without worrying about what pins are previously enabled. On the other hand, when we imagine how such a method would be used, we start to see some redundancy. In testing the 3-pin outlet, we would have to enable and disable DMM pins 12 times and get similar inefficiencies with the pins being tested.The problem is compounded when this generic function is run hundreds of times in one sequence and that sequence is run hundreds of times. The likelihood of a single relay failing (and therefore risk of downtime) is made unnecessarily high by lazy programming.<\/p>\n\n\n\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/cdn.dmcinfo.com\/wp-content\/uploads\/2025\/05\/27164324\/before.gif\"><br>\n&nbsp;<br>\nInstead, we could use our knowledge about our system and the math abilities of Python to eliminate this redundancy with a method in the MUX Manager:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e\"><span style=\"background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e\">Python<\/span><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>\nclass MUXManager:\n\n\u00a0 \u00a0 \u2026\n\n\u00a0 \u00a0 def masked_set_pins(self, pin_and_rail_list):\n\n\u00a0 \u00a0 \u00a0 \u00a0 high_pins = set()\n\n\u00a0 \u00a0 \u00a0 \u00a0 for pin_name in self.pin_names:\u00a0\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 pin_path_positive = self.get_pin_path(pin_name, Rail.POSITIVE)\u00a0\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 pin_path_negative = self.get_pin_path(pin_name, Rail.NEGATIVE)\u00a0\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 if self.read_pin(pin_path_positive):\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 high_pins.add(pin_path_positive)\u00a0\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 if self.read_pin(pin_path_negative):\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 high_pins.add(pin_path_negative)\n\n\u00a0 \u00a0 \u00a0 \u00a0 need_to_be_high_pins = set()\n\n\u00a0 \u00a0 \u00a0 \u00a0 for pin_name, rail in pin_and_rail_list:\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 pin_path = self.get_pin_path(pin_name, rail)\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 need_to_be_high_pins.add(pin_path)\n\n\n\u00a0 \u00a0 \u00a0 \u00a0 need_to_make_low_pins = high_pins - need_to_be_high_pins\n\n\u00a0 \u00a0 \u00a0 \u00a0 for path in need_to_make_low_pins:\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 self.set_pin(path, False)\n\n\u00a0 \u00a0 \u00a0 \u00a0 need_to_make_high_pins = need_to_be_high_pins - high_pins\n\n\u00a0 \u00a0 \u00a0 \u00a0 for path in need_to_make_high_pins:\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 self.set_pin(path, True) <\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">class<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">MUXManager<\/span><span style=\"color: #D4D4D4\">:<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u2026<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 <\/span><span style=\"color: #569CD6\">def<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">masked_set_pins<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">self<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #9CDCFE\">pin_and_rail_list<\/span><span style=\"color: #D4D4D4\">):<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 high_pins = <\/span><span style=\"color: #4EC9B0\">set<\/span><span style=\"color: #D4D4D4\">()<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"color: #C586C0\">for<\/span><span style=\"color: #D4D4D4\"> pin_name <\/span><span style=\"color: #C586C0\">in<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">self<\/span><span style=\"color: #D4D4D4\">.pin_names:\u00a0<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 pin_path_positive = <\/span><span style=\"color: #569CD6\">self<\/span><span style=\"color: #D4D4D4\">.get_pin_path(pin_name, Rail.POSITIVE)\u00a0<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 pin_path_negative = <\/span><span style=\"color: #569CD6\">self<\/span><span style=\"color: #D4D4D4\">.get_pin_path(pin_name, Rail.NEGATIVE)\u00a0<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">self<\/span><span style=\"color: #D4D4D4\">.read_pin(pin_path_positive):<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 high_pins.add(pin_path_positive)\u00a0<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #569CD6\">self<\/span><span style=\"color: #D4D4D4\">.read_pin(pin_path_negative):<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 high_pins.add(pin_path_negative)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 need_to_be_high_pins = <\/span><span style=\"color: #4EC9B0\">set<\/span><span style=\"color: #D4D4D4\">()<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"color: #C586C0\">for<\/span><span style=\"color: #D4D4D4\"> pin_name, rail <\/span><span style=\"color: #C586C0\">in<\/span><span style=\"color: #D4D4D4\"> pin_and_rail_list:<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 pin_path = <\/span><span style=\"color: #569CD6\">self<\/span><span style=\"color: #D4D4D4\">.get_pin_path(pin_name, rail)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 need_to_be_high_pins.add(pin_path)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 need_to_make_low_pins = high_pins - need_to_be_high_pins<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"color: #C586C0\">for<\/span><span style=\"color: #D4D4D4\"> path <\/span><span style=\"color: #C586C0\">in<\/span><span style=\"color: #D4D4D4\"> need_to_make_low_pins:<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"color: #569CD6\">self<\/span><span style=\"color: #D4D4D4\">.set_pin(path, <\/span><span style=\"color: #569CD6\">False<\/span><span style=\"color: #D4D4D4\">)<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 need_to_make_high_pins = need_to_be_high_pins - high_pins<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"color: #C586C0\">for<\/span><span style=\"color: #D4D4D4\"> path <\/span><span style=\"color: #C586C0\">in<\/span><span style=\"color: #D4D4D4\"> need_to_make_high_pins:<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"color: #569CD6\">self<\/span><span style=\"color: #D4D4D4\">.set_pin(path, <\/span><span style=\"color: #569CD6\">True<\/span><span style=\"color: #D4D4D4\">) <\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>By using set differences, we know which&nbsp;relays to turn off and on from a previous state and avoid any calls in the process that would be redundant.<\/p>\n\n\n\n<p>This is not a perfect approach and requires knowledge of the system such as whether you would be performing any hot switching or&nbsp;there needs to be an order to the switch calls.<\/p>\n\n\n\n<p>For our voltage tests, however, this approach was the right one and worked best for our client\u2019s needs.&nbsp;We can rewrite our test_voltage method to incorporate this new method as follows:<\/p>\n\n\n\n<div class=\"wp-block-kevinbatdorf-code-block-pro cbp-has-line-numbers\" data-code-block-pro-font-family=\"Code-Pro-JetBrains-Mono\" style=\"font-size:.875rem;font-family:Code-Pro-JetBrains-Mono,ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;--cbp-line-number-color:#D4D4D4;--cbp-line-number-width:calc(2 * 0.6 * .875rem);line-height:1.25rem;--cbp-tab-width:2;tab-size:var(--cbp-tab-width, 2)\"><span style=\"display:flex;align-items:center;padding:16px 0 0 16px;width:100%;text-align:left;background-color:#1e1e1e\"><span style=\"background:#c7c7c7;padding:0.3rem 0.5rem 0.2rem;border-radius:1rem;font-size:0.8em;line-height:1;height:1.25rem;text-align:center;display:inline-flex;align-items:center;justify-content:center;color:#1e1e1e\">Python<\/span><\/span><span role=\"button\" tabindex=\"0\" style=\"color:#D4D4D4;display:none\" aria-label=\"Copy\" class=\"code-block-pro-copy-button\"><pre class=\"code-block-pro-copy-button-pre\" aria-hidden=\"true\"><textarea class=\"code-block-pro-copy-button-textarea\" tabindex=\"-1\" aria-hidden=\"true\" readonly>\nclass VoltageTest:\n\n\u00a0 \u00a0 \u2026\n\n\u00a0 \u00a0 def test_voltage(self, pin_a: str, pin_b: str, expected, tolerance):\u00a0\n\n\u00a0 \u00a0 \u00a0 \u00a0 self.mux_manager.masked_set_high_pins(&#91;\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 (pin_a, Rail.POSITIVE),\u00a0\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 (\"DMM+\", Rail.POSITIVE),\u00a0\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 (pin_b, Rail.NEGATIVE),\u00a0\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 (\"DMM-\", Rail.NEGATIVE),\n\n\u00a0 \u00a0 \u00a0 \u00a0 &#93;)\u00a0\n\n\u00a0 \u00a0 \u00a0 \u00a0 measurement = self.dmm.read_voltage()\n\n\u00a0 \u00a0 \u00a0 \u00a0 if (expected - tolerance) &lt; measurement &lt; (expected + tolerance):\u00a0\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 return \"PASS\"\n\n\u00a0 \u00a0 \u00a0 \u00a0 else:\n\n\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 return \"FAIL\"\u00a0\u00a0 \u00a0<\/textarea><\/pre><svg xmlns=\"http:\/\/www.w3.org\/2000\/svg\" style=\"width:24px;height:24px\" fill=\"none\" viewBox=\"0 0 24 24\" stroke=\"currentColor\" stroke-width=\"2\"><path class=\"with-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M4.5 12.75l6 6 9-13.5\"><\/path><path class=\"without-check\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M16.5 8.25V6a2.25 2.25 0 00-2.25-2.25H6A2.25 2.25 0 003.75 6v8.25A2.25 2.25 0 006 16.5h2.25m8.25-8.25H18a2.25 2.25 0 012.25 2.25V18A2.25 2.25 0 0118 20.25h-7.5A2.25 2.25 0 018.25 18v-1.5m8.25-8.25h-6a2.25 2.25 0 00-2.25 2.25v6\"><\/path><\/svg><\/span><pre class=\"shiki dark-plus\" style=\"background-color: #1E1E1E\" tabindex=\"0\"><code><span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #569CD6\">class<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #4EC9B0\">VoltageTest<\/span><span style=\"color: #D4D4D4\">:<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u2026<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 <\/span><span style=\"color: #569CD6\">def<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #DCDCAA\">test_voltage<\/span><span style=\"color: #D4D4D4\">(<\/span><span style=\"color: #9CDCFE\">self<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #9CDCFE\">pin_a<\/span><span style=\"color: #D4D4D4\">: <\/span><span style=\"color: #4EC9B0\">str<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #9CDCFE\">pin_b<\/span><span style=\"color: #D4D4D4\">: <\/span><span style=\"color: #4EC9B0\">str<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #9CDCFE\">expected<\/span><span style=\"color: #D4D4D4\">, <\/span><span style=\"color: #9CDCFE\">tolerance<\/span><span style=\"color: #D4D4D4\">):\u00a0<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"color: #569CD6\">self<\/span><span style=\"color: #D4D4D4\">.mux_manager.masked_set_high_pins(&#91;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 (pin_a, Rail.POSITIVE),\u00a0<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 (<\/span><span style=\"color: #CE9178\">&quot;DMM+&quot;<\/span><span style=\"color: #D4D4D4\">, Rail.POSITIVE),\u00a0<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 (pin_b, Rail.NEGATIVE),\u00a0<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 (<\/span><span style=\"color: #CE9178\">&quot;DMM-&quot;<\/span><span style=\"color: #D4D4D4\">, Rail.NEGATIVE),<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 &#93;)\u00a0<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 measurement = <\/span><span style=\"color: #569CD6\">self<\/span><span style=\"color: #D4D4D4\">.dmm.read_voltage()<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"color: #C586C0\">if<\/span><span style=\"color: #D4D4D4\"> (expected - tolerance) &lt; measurement &lt; (expected + tolerance):\u00a0<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"color: #C586C0\">return<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&quot;PASS&quot;<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"color: #C586C0\">else<\/span><span style=\"color: #D4D4D4\">:<\/span><\/span>\n<span class=\"line\"><\/span>\n<span class=\"line\"><span style=\"color: #D4D4D4\">\u00a0 \u00a0 \u00a0 \u00a0 \u00a0 \u00a0 <\/span><span style=\"color: #C586C0\">return<\/span><span style=\"color: #D4D4D4\"> <\/span><span style=\"color: #CE9178\">&quot;FAIL&quot;<\/span><span style=\"color: #D4D4D4\">\u00a0\u00a0 \u00a0<\/span><\/span><\/code><\/pre><\/div>\n\n\n\n<p>Our method is more readable and efficient while reducing the relay switches per measurement. The animation given shows the decreased switching actions needed (from 24 down to 12) with this new approach \u2014 which is even more pronounced for outlets with more pins.<\/p>\n\n\n\n<p><img decoding=\"async\" alt=\"\" src=\"https:\/\/cdn.dmcinfo.com\/wp-content\/uploads\/2025\/05\/27164323\/after.gif\">&nbsp;<br>\nWhat I like most about this whole endeavor is that it confronts the fact that it illustrates how thoughtful engineering design can be exemplified in many ways \u2014&nbsp;in hardware and software. By complicating how our software works, our hardware takes fewer steps and lives longer. Good multiplexing is, well,&nbsp;multiplex.<\/p>\n\n\n\n<p><strong>Learn more about DMC&#8217;s <a href=\"https:\/\/www.dmcinfo.com\/services\/test-and-measurement-automation\/battery-pack-and-bms-test-systems\">Battery Pack and BMS Test Systems<\/a>&nbsp;and <a href=\"https:\/\/www.dmcinfo.com\/contact\">contact us<\/a> today for your next project.<\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Test and Measurement Automation projects, we often have to make numerous, quick measurements for test points on a device being tested, which we make with multiplexers. For a recent project, we needed to measure multiple AC voltages on a&nbsp;Mobile Energy Storage System. We chose multiplexers that are rated for high voltages, can carry a [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":16959,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[807,730],"tags":[],"class_list":["post-16958","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-battery-pack-test-systems","category-test-and-measurement-automation"],"yoast_head":"<title>Using Algorithms for Efficient Multiplexing | DMC, Inc.<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dmcinfo.com\/blog\/16958\/using-algorithms-for-efficient-multiplexing\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using Algorithms for Efficient Multiplexing\" \/>\n<meta property=\"og:description\" content=\"In Test and Measurement Automation projects, we often have to make numerous, quick measurements for test points on a device being tested, which we make with multiplexers. For a recent project, we needed to measure multiple AC voltages on a&nbsp;Mobile Energy Storage System. We chose multiplexers that are rated for high voltages, can carry a [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dmcinfo.com\/blog\/16958\/using-algorithms-for-efficient-multiplexing\/\" \/>\n<meta property=\"og:site_name\" content=\"DMC, Inc.\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/pages\/DMC-Inc\/107982009242929\" \/>\n<meta property=\"article:published_time\" content=\"2023-12-18T20:22:35+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-12-23T14:46:53+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/cdn.dmcinfo.com\/wp-content\/uploads\/2025\/05\/27164323\/Using-Algorithms-for-Efficient-Multiplexing-thumbnail.png\" \/>\n\t<meta property=\"og:image:width\" content=\"945\" \/>\n\t<meta property=\"og:image:height\" content=\"400\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Fadil Eledath\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Fadil Eledath\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.dmcinfo.com\/blog\/16958\/using-algorithms-for-efficient-multiplexing\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.dmcinfo.com\/blog\/16958\/using-algorithms-for-efficient-multiplexing\/\"},\"author\":{\"name\":\"Fadil Eledath\",\"@id\":\"https:\/\/www.dmcinfo.com\/#\/schema\/person\/ac665084c56204a7782a468f7bc3b3ac\"},\"headline\":\"Using Algorithms for Efficient Multiplexing\",\"datePublished\":\"2023-12-18T20:22:35+00:00\",\"dateModified\":\"2025-12-23T14:46:53+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.dmcinfo.com\/blog\/16958\/using-algorithms-for-efficient-multiplexing\/\"},\"wordCount\":680,\"publisher\":{\"@id\":\"https:\/\/www.dmcinfo.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.dmcinfo.com\/blog\/16958\/using-algorithms-for-efficient-multiplexing\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdn.dmcinfo.com\/wp-content\/uploads\/2025\/05\/27164323\/Using-Algorithms-for-Efficient-Multiplexing-thumbnail.png\",\"articleSection\":[\"Battery Pack Test Systems\",\"Test and Measurement Automation\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.dmcinfo.com\/blog\/16958\/using-algorithms-for-efficient-multiplexing\/\",\"url\":\"https:\/\/www.dmcinfo.com\/blog\/16958\/using-algorithms-for-efficient-multiplexing\/\",\"name\":\"Using Algorithms for Efficient Multiplexing | DMC, Inc.\",\"isPartOf\":{\"@id\":\"https:\/\/www.dmcinfo.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.dmcinfo.com\/blog\/16958\/using-algorithms-for-efficient-multiplexing\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.dmcinfo.com\/blog\/16958\/using-algorithms-for-efficient-multiplexing\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/cdn.dmcinfo.com\/wp-content\/uploads\/2025\/05\/27164323\/Using-Algorithms-for-Efficient-Multiplexing-thumbnail.png\",\"datePublished\":\"2023-12-18T20:22:35+00:00\",\"dateModified\":\"2025-12-23T14:46:53+00:00\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.dmcinfo.com\/blog\/16958\/using-algorithms-for-efficient-multiplexing\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.dmcinfo.com\/blog\/16958\/using-algorithms-for-efficient-multiplexing\/#primaryimage\",\"url\":\"https:\/\/cdn.dmcinfo.com\/wp-content\/uploads\/2025\/05\/27164323\/Using-Algorithms-for-Efficient-Multiplexing-thumbnail.png\",\"contentUrl\":\"https:\/\/cdn.dmcinfo.com\/wp-content\/uploads\/2025\/05\/27164323\/Using-Algorithms-for-Efficient-Multiplexing-thumbnail.png\",\"width\":945,\"height\":400,\"caption\":\"Using Algorithms for Efficient Multiplexing-thumbnail.\"},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.dmcinfo.com\/#website\",\"url\":\"https:\/\/www.dmcinfo.com\/\",\"name\":\"DMC, Inc.\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/www.dmcinfo.com\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.dmcinfo.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.dmcinfo.com\/#organization\",\"name\":\"DMC, Inc.\",\"url\":\"https:\/\/www.dmcinfo.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.dmcinfo.com\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/cdn.dmcinfo.com\/wp-content\/uploads\/2025\/05\/27171146\/dmc-logo-1.png\",\"contentUrl\":\"https:\/\/cdn.dmcinfo.com\/wp-content\/uploads\/2025\/05\/27171146\/dmc-logo-1.png\",\"width\":418,\"height\":167,\"caption\":\"DMC, Inc.\"},\"image\":{\"@id\":\"https:\/\/www.dmcinfo.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/pages\/DMC-Inc\/107982009242929\",\"https:\/\/www.instagram.com\/dmcengineering\",\"https:\/\/www.youtube.com\/DMCEngineering\",\"https:\/\/www.linkedin.com\/company\/dmc-engineering\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.dmcinfo.com\/#\/schema\/person\/ac665084c56204a7782a468f7bc3b3ac\",\"name\":\"Fadil Eledath\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.dmcinfo.com\/#\/schema\/person\/image\/\",\"url\":\"\/\/www.dmcinfo.com\/wp-content\/uploads\/wpo365\/profile-images\/2.png\",\"contentUrl\":\"\/\/www.dmcinfo.com\/wp-content\/uploads\/wpo365\/profile-images\/2.png\",\"caption\":\"Fadil Eledath\"},\"url\":\"https:\/\/www.dmcinfo.com\/blog\/author\/fadile\/\"}]}<\/script>","yoast_head_json":{"title":"Using Algorithms for Efficient Multiplexing | DMC, Inc.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.dmcinfo.com\/blog\/16958\/using-algorithms-for-efficient-multiplexing\/","og_locale":"en_US","og_type":"article","og_title":"Using Algorithms for Efficient Multiplexing","og_description":"In Test and Measurement Automation projects, we often have to make numerous, quick measurements for test points on a device being tested, which we make with multiplexers. For a recent project, we needed to measure multiple AC voltages on a&nbsp;Mobile Energy Storage System. We chose multiplexers that are rated for high voltages, can carry a [&hellip;]","og_url":"https:\/\/www.dmcinfo.com\/blog\/16958\/using-algorithms-for-efficient-multiplexing\/","og_site_name":"DMC, Inc.","article_publisher":"https:\/\/www.facebook.com\/pages\/DMC-Inc\/107982009242929","article_published_time":"2023-12-18T20:22:35+00:00","article_modified_time":"2025-12-23T14:46:53+00:00","og_image":[{"width":945,"height":400,"url":"https:\/\/cdn.dmcinfo.com\/wp-content\/uploads\/2025\/05\/27164323\/Using-Algorithms-for-Efficient-Multiplexing-thumbnail.png","type":"image\/png"}],"author":"Fadil Eledath","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Fadil Eledath","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dmcinfo.com\/blog\/16958\/using-algorithms-for-efficient-multiplexing\/#article","isPartOf":{"@id":"https:\/\/www.dmcinfo.com\/blog\/16958\/using-algorithms-for-efficient-multiplexing\/"},"author":{"name":"Fadil Eledath","@id":"https:\/\/www.dmcinfo.com\/#\/schema\/person\/ac665084c56204a7782a468f7bc3b3ac"},"headline":"Using Algorithms for Efficient Multiplexing","datePublished":"2023-12-18T20:22:35+00:00","dateModified":"2025-12-23T14:46:53+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dmcinfo.com\/blog\/16958\/using-algorithms-for-efficient-multiplexing\/"},"wordCount":680,"publisher":{"@id":"https:\/\/www.dmcinfo.com\/#organization"},"image":{"@id":"https:\/\/www.dmcinfo.com\/blog\/16958\/using-algorithms-for-efficient-multiplexing\/#primaryimage"},"thumbnailUrl":"https:\/\/cdn.dmcinfo.com\/wp-content\/uploads\/2025\/05\/27164323\/Using-Algorithms-for-Efficient-Multiplexing-thumbnail.png","articleSection":["Battery Pack Test Systems","Test and Measurement Automation"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.dmcinfo.com\/blog\/16958\/using-algorithms-for-efficient-multiplexing\/","url":"https:\/\/www.dmcinfo.com\/blog\/16958\/using-algorithms-for-efficient-multiplexing\/","name":"Using Algorithms for Efficient Multiplexing | DMC, Inc.","isPartOf":{"@id":"https:\/\/www.dmcinfo.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.dmcinfo.com\/blog\/16958\/using-algorithms-for-efficient-multiplexing\/#primaryimage"},"image":{"@id":"https:\/\/www.dmcinfo.com\/blog\/16958\/using-algorithms-for-efficient-multiplexing\/#primaryimage"},"thumbnailUrl":"https:\/\/cdn.dmcinfo.com\/wp-content\/uploads\/2025\/05\/27164323\/Using-Algorithms-for-Efficient-Multiplexing-thumbnail.png","datePublished":"2023-12-18T20:22:35+00:00","dateModified":"2025-12-23T14:46:53+00:00","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dmcinfo.com\/blog\/16958\/using-algorithms-for-efficient-multiplexing\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dmcinfo.com\/blog\/16958\/using-algorithms-for-efficient-multiplexing\/#primaryimage","url":"https:\/\/cdn.dmcinfo.com\/wp-content\/uploads\/2025\/05\/27164323\/Using-Algorithms-for-Efficient-Multiplexing-thumbnail.png","contentUrl":"https:\/\/cdn.dmcinfo.com\/wp-content\/uploads\/2025\/05\/27164323\/Using-Algorithms-for-Efficient-Multiplexing-thumbnail.png","width":945,"height":400,"caption":"Using Algorithms for Efficient Multiplexing-thumbnail."},{"@type":"WebSite","@id":"https:\/\/www.dmcinfo.com\/#website","url":"https:\/\/www.dmcinfo.com\/","name":"DMC, Inc.","description":"","publisher":{"@id":"https:\/\/www.dmcinfo.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dmcinfo.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.dmcinfo.com\/#organization","name":"DMC, Inc.","url":"https:\/\/www.dmcinfo.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dmcinfo.com\/#\/schema\/logo\/image\/","url":"https:\/\/cdn.dmcinfo.com\/wp-content\/uploads\/2025\/05\/27171146\/dmc-logo-1.png","contentUrl":"https:\/\/cdn.dmcinfo.com\/wp-content\/uploads\/2025\/05\/27171146\/dmc-logo-1.png","width":418,"height":167,"caption":"DMC, Inc."},"image":{"@id":"https:\/\/www.dmcinfo.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/pages\/DMC-Inc\/107982009242929","https:\/\/www.instagram.com\/dmcengineering","https:\/\/www.youtube.com\/DMCEngineering","https:\/\/www.linkedin.com\/company\/dmc-engineering"]},{"@type":"Person","@id":"https:\/\/www.dmcinfo.com\/#\/schema\/person\/ac665084c56204a7782a468f7bc3b3ac","name":"Fadil Eledath","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dmcinfo.com\/#\/schema\/person\/image\/","url":"\/\/www.dmcinfo.com\/wp-content\/uploads\/wpo365\/profile-images\/2.png","contentUrl":"\/\/www.dmcinfo.com\/wp-content\/uploads\/wpo365\/profile-images\/2.png","caption":"Fadil Eledath"},"url":"https:\/\/www.dmcinfo.com\/blog\/author\/fadile\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dmcinfo.com\/wp-json\/wp\/v2\/posts\/16958","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dmcinfo.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dmcinfo.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dmcinfo.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dmcinfo.com\/wp-json\/wp\/v2\/comments?post=16958"}],"version-history":[{"count":2,"href":"https:\/\/www.dmcinfo.com\/wp-json\/wp\/v2\/posts\/16958\/revisions"}],"predecessor-version":[{"id":38003,"href":"https:\/\/www.dmcinfo.com\/wp-json\/wp\/v2\/posts\/16958\/revisions\/38003"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.dmcinfo.com\/wp-json\/wp\/v2\/media\/16959"}],"wp:attachment":[{"href":"https:\/\/www.dmcinfo.com\/wp-json\/wp\/v2\/media?parent=16958"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dmcinfo.com\/wp-json\/wp\/v2\/categories?post=16958"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dmcinfo.com\/wp-json\/wp\/v2\/tags?post=16958"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}