// // File: CMovAvgFilter.cpp // // MATLAB Coder version : 4.3 // C/C++ source code generated on : 12-Jan-2022 14:14:11 // // Include Files #include "CMovAvgFilter.h" // Function Definitions // // Arguments : void // Return Type : void // CMovAvgFilter::~CMovAvgFilter() { // (no terminate code required) } void CMovAvgFilter::SetPdoa1dEnable(bool bEnable) { s_enabled_pdoa1d = bEnable; } bool CMovAvgFilter::GetPdoa1dEnable() { return s_enabled_pdoa1d; } void CMovAvgFilter::SetPdoa2dEnable(bool bEnable) { s_enabled_pdoa2d = bEnable; } bool CMovAvgFilter::GetPdoa2dEnable() { return s_enabled_pdoa2d; } // // Arguments : void // Return Type : void // CMovAvgFilter::CMovAvgFilter() { this->SD_.pd = &this->pd_; this->firstRun_not_empty_init(); this->MovAvgFilter_init(); } // // Arguments : real_T x // Return Type : real_T // real_T CMovAvgFilter::MovAvgFilter(real_T x) { real_T avg; int32_T m; if (!this->pd_.firstRun_not_empty) { this->pd_.xbuf.size[0] = 11; for (m = 0; m < 11; m++) { this->pd_.xbuf.data[m] = x; } this->pd_.prevAvg = x; this->pd_.firstRun_not_empty = true; } for (m = 0; m < 10; m++) { this->pd_.xbuf.data[m] = this->pd_.xbuf.data[m + 1]; } this->pd_.xbuf.data[10] = x; avg = this->pd_.prevAvg + (x - this->pd_.xbuf.data[0]) / 10.0; this->pd_.prevAvg = avg; return avg; } // // Arguments : void // Return Type : void // void CMovAvgFilter::MovAvgFilter_init() { this->pd_.xbuf.size[0] = 0; } bool CMovAvgFilter::s_enabled_pdoa1d = false; bool CMovAvgFilter::s_enabled_pdoa2d = false; // // Arguments : void // Return Type : void // void CMovAvgFilter::firstRun_not_empty_init() { this->pd_.firstRun_not_empty = false; } // // Arguments : void // Return Type : MovAvgFilterStackData * // MovAvgFilterStackData *CMovAvgFilter::getStackData() { return &this->SD_; } // // File trailer for CMovAvgFilter.cpp // // [EOF] //