You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/05/31 12:49:40 UTC

[GitHub] [incubator-nuttx-apps] xiaoxiang781216 commented on a diff in pull request #1174: industry/foc foc_ident: add the flux linkage identification

xiaoxiang781216 commented on code in PR #1174:
URL: https://github.com/apache/incubator-nuttx-apps/pull/1174#discussion_r885593195


##########
industry/foc/float/foc_ident.c:
##########
@@ -164,6 +164,8 @@ int foc_ident_res_run_f32(FAR struct foc_ident_f32_s *ident,
   int   ret  = FOC_ROUTINE_RUN_NOTDONE;
   float err  = 0.0f;
   float vref = 0.0f;
+  static float curr_sum  = 0.0f;
+  static float volt_sum  = 0.0f;

Review Comment:
   why use static here?



##########
industry/foc/float/foc_ident.c:
##########
@@ -343,6 +347,127 @@ int foc_ident_ind_run_f32(FAR struct foc_ident_f32_s *ident,
   return ret;
 }
 
+#ifdef CONFIG_INDUSTRY_FOC_IDENT_FLUX
+/****************************************************************************
+ * Name: foc_ident_fluxlink_run_f32
+ *
+ * Description:
+ *   Run flux linkage identification routine
+ *
+ * Input Parameter:
+ *   ident - pointer to FOC ident routine
+ *   in    - pointer to FOC routine input data
+ *   out   - pointer to FOC routine output data
+ *
+ ****************************************************************************/
+
+int foc_ident_fluxlink_run_f32(FAR struct foc_ident_f32_s *ident,
+                               FAR struct foc_routine_in_f32_s *in,
+                               FAR struct foc_routine_out_f32_s *out)
+{
+  int   ret  = FOC_ROUTINE_RUN_NOTDONE;
+  float curr_avg  = 0.0f;
+  float volt_avg  = 0.0f;
+  static float dir    = DIR_CW;
+  static float vq_sum = 0.0f;
+  static float vd_sum = 0.0f;
+  static float iq_sum = 0.0f;
+  static float id_sum = 0.0f;
+  static float vel = 0.0f;
+  static int aveg_sum  = 0;

Review Comment:
   why use static here



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org