From 928daf84a277c4155c20dbbff762170a8d48e71e Mon Sep 17 00:00:00 2001 From: 0xFEEDC0DE64 Date: Mon, 19 Oct 2020 18:25:44 +0200 Subject: [PATCH] Updated Emanuel FOC model --- bobbycar-foc-model | 2 +- main.cpp | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/bobbycar-foc-model b/bobbycar-foc-model index 24e9a0a..e41c8c6 160000 --- a/bobbycar-foc-model +++ b/bobbycar-foc-model @@ -1 +1 @@ -Subproject commit 24e9a0af18c49079c76d6e736dcc1279f7fa3c19 +Subproject commit e41c8c605c0040b2c37f445b791f46bf8ff88748 diff --git a/main.cpp b/main.cpp index 4861247..2c2b757 100644 --- a/main.cpp +++ b/main.cpp @@ -164,8 +164,14 @@ int main() HAL_ADC_Start(&hadc1); HAL_ADC_Start(&hadc2); + enum { CurrentMeasAB, CurrentMeasBC, CurrentMeasAC }; + left.rtP = rtP_Left; - left.rtP.b_selPhaABCurrMeas = 1; // Left motor measured current phases = {iA, iB} -> do NOT change +#ifdef PETERS_PLATINE + left.rtP.z_selPhaCurMeasABC = CurrentMeasBC; // Left motor measured current phases = {iB, iC} -> do NOT change +#else + left.rtP.z_selPhaCurMeasABC = CurrentMeasAB; // Left motor measured current phases = {iA, iB} -> do NOT change +#endif left.rtP.z_ctrlTypSel = uint8_t(left.state.ctrlTyp); left.rtP.b_diagEna = DIAG_ENA; left.rtP.i_max = (left.state.iMotMax * A2BIT_CONV) << 4; // fixdt(1,16,4) @@ -181,7 +187,7 @@ int main() left.rtM.outputs = &left.rtY; right.rtP = rtP_Left; - right.rtP.b_selPhaABCurrMeas = 0; // Left motor measured current phases = {iB, iC} -> do NOT change + right.rtP.z_selPhaCurMeasABC = CurrentMeasBC; // Right motor measured current phases = {iB, iC} -> do NOT change right.rtP.z_ctrlTypSel = uint8_t(right.state.ctrlTyp); right.rtP.b_diagEna = DIAG_ENA; right.rtP.i_max = (right.state.iMotMax * A2BIT_CONV) << 4; // fixdt(1,16,4)