-
Notifications
You must be signed in to change notification settings - Fork 20
Update dmm current modes #225
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
jcollins1983
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a couple of minor things that I think need tweaking. But I'm generally onboard based on our discussions the other day.
WRT breaking changes, what impact is there if a script is updated but is run on an older version of Fixate?
Have you done a review of the number of scripts that would be impacted and considered a rollout plan?
docs/release-notes.rst
Outdated
|
|
||
| Improvements | ||
| ############ | ||
| - DMM current mode functions now raise an exception when an incompatible port combination is used. The range and port parameters are now required parameters. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these two sentences should be swapped.
when an imcompatible port combination
Is this trying to say an incompatible port and range combination?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to make sense.
| raise NotImplementedError | ||
|
|
||
| def current_ac(self, _range): | ||
| def current_ac(self, _range, port: Literal["HIGH", "LOW"]): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we're going to introduce braking changes, maybe now is a good opportunity to make the not so private private _range not private anymore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did have this thought, then it annoyed me that only one function in the whole API uses the correct naming convention. I know it's wrong, but I almost prefer to have everything consistent? Let me know if you really want me to change it.
|
|
||
| # High and low current port definition. Each definition encodes the maximum current able to | ||
| # be measured by the port (in amps) | ||
| self.current_ports = {"HIGH": 10, "LOW": 400e-3} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think self.current_ports should be private in the hopes that people aren't tempted to update them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
| # Raise an error if the high port is selected when the low port should be used: | ||
| if _range < self.current_ports["LOW"] and port == "HIGH": | ||
| raise ValueError( | ||
| "High range port selected when the low range port should be used! Consider using a different multimeter." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the consideration here be to use the low current port?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that not what it is doing already? If a small range is selected, and the high port requested, the driver will throw an exception requesting that the low range port should be used instead.
This is because the DMM will often select the low range port automatically based on the given range, so I thought it helpful to force the port selection to reduce unexpected behavior.
| """ | ||
|
|
||
| # Check the requested range is not more than the port capability: | ||
| if _range > self.current_ports[port]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of duplicating these checks, could we pull them out into their own method and calling that from the AC and DC methods?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved the checks over to a function that is now defined in the helper. That way both the drivers just use that function.
| """ | ||
|
|
||
| # Check the requested range is not more than the port capability: | ||
| if _range > self.current_ports[port]: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment RE duplication as in the fluke driver.
|
This is what happens if you use an updated test script with an older version of fixate (you get an unexpected keyword argument exception): Likewise, if you update fixate, and not the test script, you will get an error because the function call will be missing a required argument. Running atgrep with the following: And for DC current: I have removed some of the lines from the output to hide multiple calls in one file, just to reduce the noise a little. Other than that, I think I have addressed the comments, and updated the tests to work with the updates. |
|
@Jasper-Harvey0 If I understand your last comment correctly, this can be merged until a handful of scripts are updated first. I assume that hasn't happened, so this is waiting on that? |
|
Yes I believe that is the case. As long as people are happy with the proposed way forward, |
This is picking up part of the work that I originally tried to do over on #205, but with a reduced scope to look at the DMM current mode functions.
Basically we need to start using the Keithley DMMs in production sooner rather than later, and the high / low current port measurement range mismatch is something that has been in the back of my mind to fix...
The changes add a required 'port' parameter to inform the driver which port is intended to be used for the measurement. The range parameter is also now required. I think this is a reasonable change because the person designing the test script is going to have this information already.
We don't add any magic to the driver that tries to set ranges for you based on the port, rather, we simply raise an error if the port and range combination is incompatible. This will avoid potentially damaging situations occurring on jigs, and will simply trigger production to grab an Engineer if the exception is raised.
It can then be decided if the multimeter is to be swapped to a compatible one, or change the test script / jig hardware to work across all instruments.
This is a breaking change for any test script that uses the current functions because of the new required port parameter.