Prius IPM controller

Dependencies:   mbed

Fork of analoghalls5_5 by N K

Committer:
bwang
Date:
Mon Mar 16 15:40:07 2015 +0000
Revision:
35:83cf9564bd0c
Parent:
33:e7b132029bae
Set for 3A Iq, 0A Id, Ki = 1e-3, Kp = Kd = 0, loop still oscillates but is passable

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bwang 0:54cf32d35f4d 1 #include "includes.h"
bwang 1:1f58bdcf2956 2 #include "core.h"
bwang 1:1f58bdcf2956 3 #include "sensors.h"
bwang 0:54cf32d35f4d 4
nki 33:e7b132029bae 5 Motor::Motor(CurrentSensor *sense_c, CurrentSensor *sense_b, PositionSensor *sense_p, TempSensor *sense_t) {
nki 33:e7b132029bae 6 _sense_c = sense_c;
nki 33:e7b132029bae 7 _sense_b = sense_b;
bwang 0:54cf32d35f4d 8 _sense_p = sense_p;
bwang 0:54cf32d35f4d 9 _sense_t = sense_t;
bwang 0:54cf32d35f4d 10 }
bwang 0:54cf32d35f4d 11
bwang 11:dccbaa9274c5 12 float Motor::GetCurrentC() {
nki 33:e7b132029bae 13 return _sense_c->GetCurrent();
bwang 0:54cf32d35f4d 14 }
bwang 0:54cf32d35f4d 15
bwang 11:dccbaa9274c5 16 float Motor::GetCurrentB() {
nki 33:e7b132029bae 17 return _sense_b->GetCurrent();
bwang 0:54cf32d35f4d 18 }
bwang 0:54cf32d35f4d 19
bwang 11:dccbaa9274c5 20 float Motor::GetPosition() {
bwang 11:dccbaa9274c5 21 return _sense_p->GetPosition();
bwang 0:54cf32d35f4d 22 }
bwang 0:54cf32d35f4d 23
bwang 11:dccbaa9274c5 24 float Motor::GetTemp() {
bwang 11:dccbaa9274c5 25 return _sense_t->GetTemp();
bwang 0:54cf32d35f4d 26 }
bwang 0:54cf32d35f4d 27
bwang 0:54cf32d35f4d 28 void Motor::Config(int num_poles, float kv) {
bwang 0:54cf32d35f4d 29 _num_poles = num_poles;
bwang 0:54cf32d35f4d 30 _kv = kv;
bwang 0:54cf32d35f4d 31 }