ControllerQ31.cpp 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. #include "ControllerQ31.h"
  2. #include "Error.h"
  3. void ControllerQ31::test_pid_q31()
  4. {
  5. for(int i=0; i < this->nbSamples; i++)
  6. {
  7. *this->pDst++ = arm_pid_q31(&instPid, *this->pSrc++);
  8. }
  9. }
  10. void ControllerQ31::test_clarke_q31()
  11. {
  12. q31_t Ialpha;
  13. q31_t Ibeta;
  14. for(int i=0; i < this->nbSamples; i++)
  15. {
  16. arm_clarke_q31(0xccccccd,0x1999999a,&Ialpha,&Ibeta);
  17. }
  18. }
  19. void ControllerQ31::test_inv_clarke_q31()
  20. {
  21. q31_t Ia;
  22. q31_t Ib;
  23. for(int i=0; i < this->nbSamples; i++)
  24. {
  25. arm_clarke_q31(0xccccccd,0x1999999a,&Ia,&Ib);
  26. }
  27. }
  28. void ControllerQ31::test_park_q31()
  29. {
  30. q31_t Id,Iq;
  31. for(int i=0; i < this->nbSamples; i++)
  32. {
  33. arm_park_q31(0xccccccd,0x1999999a,&Id,&Iq,0xccccccd,0x1999999a);
  34. }
  35. }
  36. void ControllerQ31::test_inv_park_q31()
  37. {
  38. q31_t Ialpha,Ibeta;
  39. for(int i=0; i < this->nbSamples; i++)
  40. {
  41. arm_inv_park_q31(0xccccccd,0x1999999a,&Ialpha,&Ibeta,0xccccccd,0x1999999a);
  42. }
  43. }
  44. void ControllerQ31::test_sin_cos_q31()
  45. {
  46. q31_t sinVal,cosVal;
  47. for(int i=0; i < this->nbSamples; i++)
  48. {
  49. arm_sin_cos_q31(0xccccccd,&sinVal,&cosVal);
  50. }
  51. }
  52. void ControllerQ31::setUp(Testing::testID_t id,std::vector<Testing::param_t>& params,Client::PatternMgr *mgr)
  53. {
  54. std::vector<Testing::param_t>::iterator it = params.begin();
  55. this->nbSamples = *it;
  56. samples.reload(ControllerQ31::SAMPLES_Q31_ID,mgr,this->nbSamples);
  57. output.create(this->nbSamples,ControllerQ31::OUT_SAMPLES_Q31_ID,mgr);
  58. switch(id)
  59. {
  60. case TEST_PID_Q31_1:
  61. arm_pid_init_q31(&instPid,1);
  62. break;
  63. }
  64. this->pSrc=samples.ptr();
  65. this->pDst=output.ptr();
  66. }
  67. void ControllerQ31::tearDown(Testing::testID_t id,Client::PatternMgr *mgr)
  68. {
  69. }