Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed-dev-f303 FastPWM3
CurrentRegulator/CurrentRegulator.h@9:d7eb815cb057, 2016-05-10 (annotated)
- Committer:
- benkatz
- Date:
- Tue May 10 01:15:57 2016 +0000
- Revision:
- 9:d7eb815cb057
- Parent:
- 8:10ae7bc88d6e
- Child:
- 10:370851e6e132
Fixed current scaling hack
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
benkatz | 9:d7eb815cb057 | 1 | #ifndef CURRENTREGULATOR_H |
benkatz | 0:4e1c4df6aabd | 2 | #define CURRENTREGULATOR_H |
benkatz | 9:d7eb815cb057 | 3 | |
benkatz | 0:4e1c4df6aabd | 4 | #include "Inverter.h" |
benkatz | 0:4e1c4df6aabd | 5 | #include "SVM.h" |
benkatz | 0:4e1c4df6aabd | 6 | #include "PositionSensor.h" |
benkatz | 0:4e1c4df6aabd | 7 | |
benkatz | 0:4e1c4df6aabd | 8 | class CurrentRegulator{ |
benkatz | 0:4e1c4df6aabd | 9 | public: |
benkatz | 0:4e1c4df6aabd | 10 | CurrentRegulator(Inverter *inverter, PositionSensor *position_sensor, float Kp, float Ki); |
benkatz | 0:4e1c4df6aabd | 11 | void UpdateRef(float D, float Q); |
benkatz | 0:4e1c4df6aabd | 12 | void Commutate(); |
benkatz | 9:d7eb815cb057 | 13 | void Reset(); |
benkatz | 0:4e1c4df6aabd | 14 | private: |
benkatz | 5:51c6560bf624 | 15 | float IQ_Ref, ID_Ref, V_Q, V_D, V_Alpha, V_Beta, V_A, V_B, V_C, I_Q, I_D, I_A, I_B, I_C, I_Alpha, I_Beta, theta_elec, _Kp, _Ki; |
benkatz | 9:d7eb815cb057 | 16 | float Q_Integral, D_Integral, Q_Error, D_Error, Int_Max, DTC_Max, Q_Max; |
benkatz | 0:4e1c4df6aabd | 17 | void SampleCurrent(); |
benkatz | 0:4e1c4df6aabd | 18 | void SetVoltage(); |
benkatz | 0:4e1c4df6aabd | 19 | void Update(); |
benkatz | 4:c023f7b6f462 | 20 | void SendSPI(); |
benkatz | 0:4e1c4df6aabd | 21 | Inverter* _Inverter; |
benkatz | 0:4e1c4df6aabd | 22 | PositionSensor* _PositionSensor; |
benkatz | 6:4ee1cdc43aa8 | 23 | SVM* PWM; |
benkatz | 8:10ae7bc88d6e | 24 | Serial* pc; |
benkatz | 8:10ae7bc88d6e | 25 | int count; |
benkatz | 0:4e1c4df6aabd | 26 | |
benkatz | 0:4e1c4df6aabd | 27 | |
benkatz | 0:4e1c4df6aabd | 28 | |
benkatz | 0:4e1c4df6aabd | 29 | }; |
benkatz | 0:4e1c4df6aabd | 30 | |
benkatz | 0:4e1c4df6aabd | 31 | |
benkatz | 0:4e1c4df6aabd | 32 | #endif |