IIRFilter.hpp
Go to the documentation of this file.
00001 // ----------------------------------------------------------------------------
00002 //
00003 // $Id$
00004 //
00005 // Copyright 2008, 2009, 2010, 2011  Antonio Franchi
00006 //
00007 // This file is part of TeleKyb.
00008 //
00009 // TeleKyb is free software: you can redistribute it and/or modify
00010 // it under the terms of the GNU General Public License as published by
00011 // the Free Software Foundation, either version 3 of the License, or
00012 // (at your option) any later version.
00013 //
00014 // TeleKyb is distributed in the hope that it will be useful,
00015 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00016 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017 // GNU General Public License for more details.
00018 //
00019 // You should have received a copy of the GNU General Public License
00020 // along with TeleKyb. If not, see <http://www.gnu.org/licenses/>.
00021 //
00022 // Contact info: antonio.franchi@tuebingen.mpg.de 
00023 //
00024 // ----------------------------------------------------------------------------
00025 
00026 
00030 
00032 /* @{ */
00033 
00034 #ifndef IIR_FILTER_HPP_
00035 #define IIR_FILTER_HPP_
00036 
00037 #include <telekyb_defines/telekyb_defines.hpp>
00038 #include <telekyb_base/Time.hpp>
00039 
00040 #include <vector>
00041 #include <list>
00042 
00043 namespace TELEKYB_NAMESPACE
00044 {
00045 
00046 // esempio per order = 3
00047 // implementa la funzione di trasferimento:
00048 // _inCoeff[0]  +  _inCoeff[1] z +  _inCoeff[2] z^2 + _inCoeff[3] z^3
00049 // ------------------------------------------------------------------
00050 //      _outCoeff[0] + _outCoeff[1] z + _outCoeff[2] z^2 + z^3
00051 //
00052 // ossia
00053 //
00054 //y[t] =  _inCoeff[0] * u[t-3] +  _inCoeff[1] * u[t-2] +  _inCoeff[2] * u[t-1] + _inCoeff[3] * u[t]
00055 //               - _outCoeff[0] * y[t-3] - _outCoeff[1] * y[t-2] - _outCoeff[2] * y[t-1]
00056 
00057 
00058 class IIRLowPass {};
00059 class IIRFiltDeriv {};
00060 class IIRLowPassButtW {};
00061 class IIRFiltDerivButtW {};
00062 
00069 class IIRFilter{
00070         private:
00071                 std::vector< std::vector<double> > _inCoeff;
00072                 std::vector<double> _outCoeff;
00073                 std::vector< std::list<double> > _pastIns;
00074                 std::list<double> _pastOuts;
00075                 int _order;
00076                 int _inNum;
00077                 std::list<double>::iterator outIt,inIt;
00078                 int iCo,iIn;
00079 
00080                 void _kernelConstructor(std::vector< std::vector<double> > &inputCoeff,std::vector<double> &outputCoeff);
00081         public:
00082 
00093                 IIRFilter(std::vector<double> &inputCoeff,std::vector<double> &outputCoef);
00094 
00105                 IIRFilter(std::vector< std::vector<double> > &inputCoeff,std::vector<double> &outputCoef);
00106 
00112                 IIRFilter(IIRLowPass dummyType, double wn, double csi, double ts);
00113 
00119                 IIRFilter(IIRFiltDeriv dummyType, double wn, double csi, double ts);
00120 
00121 
00122 
00123 
00124 
00130                 IIRFilter(IIRLowPassButtW dummyType, double wn, double ts);
00131 
00132 
00133 
00139                 IIRFilter(IIRFiltDerivButtW dummyType, double wn, double ts);
00140 
00141 
00142 
00143 
00144                 ~IIRFilter();
00145 
00147                 IIRFilter(const IIRFilter& t);
00148 
00150                 IIRFilter& operator=(const IIRFilter& t);
00151 
00156                 void step(double in,double& out);
00157 
00161                 void step(const std::vector<double>& in,double& out);
00162 };
00163 
00164 
00165 
00166 } // namespace
00167 #endif
00168 
00169 /* @} */
00170 
00171 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends Defines


telekyb_base
Author(s): Dr. Antonio Franchi and Martin Riedel
autogenerated on Mon Nov 11 2013 11:12:34