Prius IPM controller

Dependencies:   mbed

Fork of analoghalls5_5 by N K

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers main.cpp Source File

main.cpp

00001 #include "includes.h"
00002 #include "transforms.h"
00003 #include "filters.h"
00004 #include "context.h"
00005 #include "core.h"
00006 #include "meta.h"
00007 #include "sensors.h"
00008 #include "callbacks.h"
00009 
00010 int main() { 
00011     Context *context = new Context();
00012     context->ConfigureOutputs(D6, D13, D3, D8);
00013     context->ConfigureCurrentSensors(A1, A2, 0.01f, 0.7f);
00014     context->ConfigureIdPidController(0.001f, 0.0f, 0.0f, 1.0f, -1.0f);
00015     context->ConfigureIqPidController(0.001f, 0.0f, 0.0f, 1.0f, -1.0f);
00016     context->ConfigureThrottle(A0, 0.8f, 3.0f);
00017     context->ConfigurePositionSensor(A4, A5, 0.249f, 0.497f, 0.231f, 0.499f, 205.0f);
00018     context->ConfigureReference(3.0f);  // max phase current
00019     context->ConfigureDebugger(2, 2000);
00020     context->AttachCallBack(&fast, 5000);
00021     context->AttachCallBack(&slow, 10);
00022     context->AttachCallBack(&debug, 10);
00023     context->AttachCallBack(&log, 500);
00024     context->Start();
00025 }