Skip to content

Commit 644acaa

Browse files
committed
Fix incorrect reported current on PCS
After setting the current to zero, the reported current was 3.3 mA. The actual current was correct, i.e. zero.
1 parent 572e0a9 commit 644acaa

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

pslab/instrument/power_supply.py

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,17 @@ def current(self):
211211

212212
@current.setter
213213
def current(self, value: float):
214-
raw = 0 if value == 0 else self.unscale(value)
215-
raw = int(np.clip(raw, 0, self._RESOLUTION))
216-
self._multi_write(raw)
217-
self._current = self.scale(raw)
214+
# Output current is a function of the voltage set on the MCP4728's V+
215+
# pin (assuming negligible load resistance):
216+
# I(V) = 3.3e-3 - V / 1000
217+
# I.e. the lower the voltage the higher the current. However, the
218+
# function is discontinuous in V = 0:
219+
# I(0) = 0
220+
if value == 0:
221+
self._multi_write(0)
222+
self._current = 0
223+
else:
224+
raw = self.unscale(value)
225+
raw = int(np.clip(raw, 0, self._RESOLUTION))
226+
self._multi_write(raw)
227+
self._current = self.scale(raw)

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy