-
Notifications
You must be signed in to change notification settings - Fork 2
Add current sensor calibration documentation #95
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
Conversation
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.
Thanks @anirudhupadhyaya! This is on a good track here and will be really useful. @npetersen2 and I took a look together and have a few revision requests for you to address:
- Add a top level discussion (perhaps in
Background) on why we need to calibrate a current sensor (i.e., fending off a question of "it has a data sheet, why not just use the values in the datasheet?") and that we need to calibrating against some known reference. In this article you have chosen to use a oscilloscope probe as your reference. But in reality, this is not a great reference. A DMM or precision multimeter would be better (but the scope probe is often convenient and maybe is good enough). The point I am trying to get at here is articulate the concept in general that they need to calibrate against a reference and it is up to the user to pick a suitable reference for their needs - Focus on making this describe the simplest, most general case of current sensor calibration. As part of this, remove the commentary on the AMDS -- this article should apply equally to whether a user is using the AMDS, AMDC analog ports, or some other system.
- As part of making this article simpler, could you adjust the perspective of the article to be describing the current measurement calibration for a 3 phase motor? As part of this, please include a figure the shows a three phase motor, current sensor, and drive. And then revise your method to refer to this. (Right now, some of the steps are quite confusing and need clarification to be simpler --> i.e., why does step 4 refer to phase U and step 5 refers to both phase U and phase A?)
- Provide a data in CSV file and a Python script, that takes that data and makes the fit (calculates gain and offset) and creates a plot of the raw current measurement data and the resulting fit. Include this plot in your article. NOTE: while of course it is nice if you show us real data, it is also okay if you need to fabricate artificial example data (this is the only time you'll hear me say it is okay to fabricate data!)
- Your article correctly indicates that it is best to have both positive and negative currents. Can you revise the data that you are showing to include positive and negative currents?
- The current table that you provide shows sensor reading voltages up to 20.0 V. This doesn't seem correct, as the AMDC is not able to read 20 V. Can you provide data the corresponds to the AMDCs capabilities.
|
@elsevers I have addressed the changes and ready for another review. |
...ce/getting-started/control-with-amdc/current-sensor-cal/resources/current_sesnor_drawing.svg
Show resolved
Hide resolved
...ting-started/control-with-amdc/current-sensor-cal/resources/Current_sensor_calibration.ipynb
Outdated
Show resolved
Hide resolved
source/getting-started/control-with-amdc/current-sensor-cal/resources/Fit.svg
Show resolved
Hide resolved
|
@npetersen2 I have addressed your review comments.. |
npetersen2
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.
Thanks @anirudhupadhyaya
Let's get a review from @elsevers now before merging
elsevers
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.
Thanks @anirudhupadhyaya! This is getting close.
I noted a small type-o edit below to make, and then have a request below.
In addition to this, can you please include a [brief] new section called something like "Use of Calibration Data" that gives the user a block of C-Code that uses the measured Offset and Gain to convert between their raw measurements and the values that they should use in their control algorithm?
source/getting-started/control-with-amdc/current-sensor-cal/index.md
Outdated
Show resolved
Hide resolved
@elsevers I have taken a stab at this. Please take a look. |
elsevers
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.
@anirudhupadhyaya I think this is going to be a useful article. Please review/edit/merge my changes in PR #105, and then I am ready to approve.
…sor_cal_doc Edit current sensor calibration document
@elsevers thanks, I have merged your pull request. |
| ```C | ||
| #define GAIN 0.621 // Gain from curve fit | ||
| #define OFFSET 4.739 // Offset from curve fit | ||
|
|
||
| double current_measurement; // Actual current measurement, to be used in control algorithm | ||
|
|
||
| current_measurement = (sensor_reading - OFFSET)/GAIN; // sensor_reading is the raw measurement and needs to be obtained by the user | ||
|
|
||
| ``` |
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.
Hmm. Is this really how you implement this in your code? I would expect to see a multiply operation used (typically faster), so the inverse operation would be computed at compile time in the define statement, e.g., (1.0 / 0.621) or something like that.
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.
Also, a real implementation would be a bit more "complex" since usually we want to recalibrate during boot-up, so having constants as defines does not work... I do not think you need to give the reader all possible code they would want, but can you add a comment explaining this?
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 have added a comment alongside OFFSET define
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 suggest changing offset to be a global variable and update the comment. See my suggestion in my review.
source/getting-started/control-with-amdc/current-sensor-cal/index.md
Outdated
Show resolved
Hide resolved
elsevers
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.
Thanks @anirudhupadhyaya. It seems like we are very close here.
source/getting-started/control-with-amdc/current-sensor-cal/index.md
Outdated
Show resolved
Hide resolved
source/getting-started/control-with-amdc/current-sensor-cal/index.md
Outdated
Show resolved
Hide resolved
| ```C | ||
| #define GAIN 0.621 // Gain from curve fit | ||
| #define OFFSET 4.739 // Offset from curve fit | ||
|
|
||
| double current_measurement; // Actual current measurement, to be used in control algorithm | ||
|
|
||
| current_measurement = (sensor_reading - OFFSET)/GAIN; // sensor_reading is the raw measurement and needs to be obtained by the user | ||
|
|
||
| ``` |
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 suggest changing offset to be a global variable and update the comment. See my suggestion in my review.
Co-authored-by: Eric Severson <[email protected]>
|
@elsevers I have accepted your suggestions. |
source/getting-started/control-with-amdc/current-sensor-cal/index.md
Outdated
Show resolved
Hide resolved
source/getting-started/control-with-amdc/current-sensor-cal/index.md
Outdated
Show resolved
Hide resolved
elsevers
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.
Looks good.
* Add initial template of new docs control content per #77 * Update index.md * Add current sensor calibration documentation (#95) * Initial commit * Update readme * Update readme * Update readme * Add files * Update files * Changes * Changes * Update files * Get rif of scope image * Minor updates * Address review comments * Remove resources * Add back resources * Address review comments * Address review comments * Update index.md * Edit current sensor calibration method section * Edit calibration method section * Add section on Recalcilating current sensor offset * Clarify that we measure a voltage. * Edit conclusion * Update index.md * Update index.md * Address review comments * Update index.md * Update index.md * Update index.md * Apply suggestions from code review Co-authored-by: Eric Severson <[email protected]> * Update source/getting-started/control-with-amdc/current-sensor-cal/index.md * Update source/getting-started/control-with-amdc/current-sensor-cal/index.md --------- Co-authored-by: Nathan Petersen <[email protected]> Co-authored-by: Eric Severson <[email protected]> * Fix current calibration images (#116) * Add control topic TOC * Remove placeholder articles * Remove unused TOC entries --------- Co-authored-by: Nathan Petersen <[email protected]> Co-authored-by: Anirudh Upadhyaya <[email protected]> Co-authored-by: Nathan Petersen <[email protected]>
I have prepared a first draft of this document. Let me know if this is going in the right direction and your suggestions on what you would like to see.
The document is here.
Thanks.