Program for current regulation of BLDC motor.
Dependents: CurrentMeasurement
Fork of CurrentRegulation by
CurrentRegulation.h@1:9406a55d8a12, 2015-08-24 (annotated)
- Committer:
- dfraj
- Date:
- Mon Aug 24 11:13:04 2015 +0000
- Revision:
- 1:9406a55d8a12
- Parent:
- 0:d8dab3dae6f2
- Child:
- 2:f71d1fb67922
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 | 1:9406a55d8a12 | 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, PinName GH_C, PinName GL_C, PinName h1, PinName h2, PinName h3, PinName Fault); |
dfraj | 0:d8dab3dae6f2 | 11 | void setValues(double R_sh, double R_1, double R_fs, double R_ft, double V_ref); |
dfraj | 1:9406a55d8a12 | 12 | double calculateCurrentA(); |
dfraj | 1:9406a55d8a12 | 13 | double calculateCurrentB(); |
dfraj | 1:9406a55d8a12 | 14 | double calculateCurrentC(); |
dfraj | 1:9406a55d8a12 | 15 | double calculateTotalCurrent(); |
dfraj | 1:9406a55d8a12 | 16 | double calculateKr(); |
dfraj | 1:9406a55d8a12 | 17 | double phaseCurrent(int currentSector); |
dfraj | 1:9406a55d8a12 | 18 | void measuring(); |
dfraj | 1:9406a55d8a12 | 19 | void input(double in); |
dfraj | 0:d8dab3dae6f2 | 20 | private: |
dfraj | 0:d8dab3dae6f2 | 21 | AnalogIn I_A, I_B, I_C, I_TOTAL; |
dfraj | 1:9406a55d8a12 | 22 | 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, setPoint, procesValue, I_Ar, u; |
dfraj | 1:9406a55d8a12 | 23 | int sector; |
dfraj | 1:9406a55d8a12 | 24 | Ticker measure; |
dfraj | 1:9406a55d8a12 | 25 | PI reg; |
dfraj | 1:9406a55d8a12 | 26 | BLDCmotorDriver m; |
dfraj | 0:d8dab3dae6f2 | 27 | }; |
dfraj | 0:d8dab3dae6f2 | 28 | |
dfraj | 0:d8dab3dae6f2 | 29 | #endif |