MTC - Scalar Control General Functionality - #71
Conversation
| Vq = Kp * IqError + integral_term_Iq; | ||
| } | ||
|
|
||
| void VectorController::parkTransform() { |
There was a problem hiding this comment.
This should be inverse park
There was a problem hiding this comment.
Sorry about that. Changes done in second commit.
|
Probably don't even need to review. We are apparently changing to scalar control now. |
TomLonergan03
left a comment
There was a problem hiding this comment.
Good start, run clang-format over everything. Also, what is used as the actual PWM duty cycle? Or what values will that be calculated from?
| core::Float Ia; | ||
| core::Float Ib; | ||
| core::Float Ic; | ||
| core::Float rotorVelocity; | ||
| core::Float Id; | ||
| core::Float Iq; | ||
| core::Float Vd; | ||
| core::Float Vq; | ||
| core::Float IdRef; | ||
| core::Float IqRef; | ||
| core::Float Kp; | ||
| core::Float Ki; | ||
| core::Float theta; |
There was a problem hiding this comment.
- Rename most of these to be clear on what they actually are
- Variables should be named in
lower_snake_caseand class data members should have a trailing_, socurrent_phase_a_etc. - Move the private block after public.
| } | ||
|
|
||
|
|
||
| int main() { |
There was a problem hiding this comment.
get rid of the main function
| } | ||
|
|
||
| // Convert to 2-axis system | ||
| void VectorController::convertTo2Axis() { |
There was a problem hiding this comment.
these functions should take parameters and return values instead of doing random stuff to internal variables, cos until the end of this function there will be a Id and Iq which are outdated
| void measureCurrentsAndVelocity(core::Float ia, core::Float ib, core::Float ic, core::Float rotorVelocity); | ||
| void convertTo2Axis(); | ||
| void inverse2Axis(); | ||
| void piControl(); | ||
| void inverseParkTransform(); |
There was a problem hiding this comment.
most of these should be private, and used by public methods
Pass in the new currents and velocity and do the rest of it internally unless these methods definitely need to be called elsewhere
Class for Vector Control, header and main file. This is the initial overview of how vector control will work. We just need it now to merge with CAN messages. All steps are added until the space vector modulation