robot

Dependencies:   FastPWM3 mbed

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers CurrentModel.cpp Source File

CurrentModel.cpp

00001 #include "CurrentModel.h"
00002 
00003 CurrentModel::CurrentModel(float Lr, float Rr, float fsw) {
00004     _tauinv = Rr / Lr;
00005     _tsw = 1.0f / fsw;
00006     
00007     _im = 0.0f;
00008     _theta = 0.0f;
00009 }
00010 
00011 float CurrentModel::getFluxPosition(float id, float iq, float w) {
00012     _im = _im + _tsw * _tauinv * (id - _im);
00013     float wf = w + _tauinv * iq / _im;
00014     _theta = _theta + _tsw * wf;
00015     return _theta;
00016 }