Program for current regulation of BLDC motor.
Dependents: CurrentMeasurement
Fork of CurrentRegulation by
CurrentRegulation.h@2:f71d1fb67922, 2015-08-25 (annotated)
- Committer:
- dfraj
- Date:
- Tue Aug 25 19:14:01 2015 +0000
- Revision:
- 2:f71d1fb67922
- Parent:
- 1:9406a55d8a12
v0.2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dfraj | 0:d8dab3dae6f2 | 1 | #ifndef CURRENTREGULATION_H |
dfraj | 0:d8dab3dae6f2 | 2 | #define CURRENTREGULATION_H |
dfraj | 0:d8dab3dae6f2 | 3 | |
dfraj | 0:d8dab3dae6f2 | 4 | #include "mbed.h" |
dfraj | 1:9406a55d8a12 | 5 | #include "BLDCmotorDriver.h" |
dfraj | 1:9406a55d8a12 | 6 | #include "PI.h" |
dfraj | 0:d8dab3dae6f2 | 7 | |
dfraj | 0:d8dab3dae6f2 | 8 | class CurrentRegulation{ |
dfraj | 0:d8dab3dae6f2 | 9 | public: |
dfraj | 2:f71d1fb67922 | 10 | CurrentRegulation(PinName I_A, PinName I_B, PinName I_C, PinName I_TOTAL, PinName GH_A, PinName GL_A, PinName GH_B, PinName GL_B, |
dfraj | 2:f71d1fb67922 | 11 | PinName GH_C, PinName GL_C, PinName h1, PinName h2, PinName h3, PinName Fault); |
dfraj | 0:d8dab3dae6f2 | 12 | void setValues(double R_sh, double R_1, double R_fs, double R_ft, double V_ref); |
dfraj | 1:9406a55d8a12 | 13 | double calculateCurrentA(); |
dfraj | 1:9406a55d8a12 | 14 | double calculateCurrentB(); |
dfraj | 1:9406a55d8a12 | 15 | double calculateCurrentC(); |
dfraj | 1:9406a55d8a12 | 16 | double calculateTotalCurrent(); |
dfraj | 1:9406a55d8a12 | 17 | double calculateKr(); |
dfraj | 1:9406a55d8a12 | 18 | double phaseCurrent(int currentSector); |
dfraj | 1:9406a55d8a12 | 19 | void measuring(); |
dfraj | 2:f71d1fb67922 | 20 | void getValue(); |
dfraj | 2:f71d1fb67922 | 21 | //void input(double in); |
dfraj | 2:f71d1fb67922 | 22 | void setOutput(double in); |
dfraj | 0:d8dab3dae6f2 | 23 | private: |
dfraj | 0:d8dab3dae6f2 | 24 | AnalogIn I_A, I_B, I_C, I_TOTAL; |
dfraj | 2:f71d1fb67922 | 25 | double R_sh, R_1, R_fs, R_ft, V_ref, I_A_, I_B_, I_C_, I_TOTAL_, zeta, T_suma, T_ch, T_pv, T_I, K_ch, K_R, K_pv, K_a, K_oR, T_d, |
dfraj | 2:f71d1fb67922 | 26 | setPoint, procesValue, I_Ar, u, output; |
dfraj | 1:9406a55d8a12 | 27 | int sector; |
dfraj | 1:9406a55d8a12 | 28 | Ticker measure; |
dfraj | 1:9406a55d8a12 | 29 | PI reg; |
dfraj | 1:9406a55d8a12 | 30 | BLDCmotorDriver m; |
dfraj | 0:d8dab3dae6f2 | 31 | }; |
dfraj | 0:d8dab3dae6f2 | 32 | |
dfraj | 0:d8dab3dae6f2 | 33 | #endif |