|
mbsimcontrol
3.3.0
|
00001 /* Copyright (C) 2004-2009 MBSim Development Team 00002 * 00003 * This library is free software; you can redistribute it and/or 00004 * modify it under the terms of the GNU Lesser General Public 00005 * License as published by the Free Software Foundation; either 00006 * version 2.1 of the License, or (at your option) any later version. 00007 * 00008 * This library is distributed in the hope that it will be useful, 00009 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00011 * Lesser General Public License for more details. 00012 * 00013 * You should have received a copy of the GNU Lesser General Public 00014 * License along with this library; if not, write to the Free Software 00015 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 00016 * 00017 * Contact: markus.ms.schneider@gmail.com 00018 */ 00019 00020 #ifndef _FUNCTION_SENSOR_H_ 00021 #define _FUNCTION_SENSOR_H_ 00022 00023 #include "mbsimControl/sensor.h" 00024 #include "mbsim/utils/function.h" 00025 00026 namespace MBSimControl { 00027 00032 class FunctionSensor : public Sensor { 00033 public: 00034 FunctionSensor(const std::string &name="") : Sensor(name), function(NULL), y() {} 00035 FunctionSensor(const std::string &name, MBSim::Function1<fmatvec::Vec, double>* function_); 00036 std::string getType() const { return "FunctionSensor"; } 00037 void setFunction(MBSim::Function1<fmatvec::Vec, double>* function_); 00038 fmatvec::Vec getSignal() {return y.copy(); } 00039 void updateg(double t); 00040 void initializeUsingXML(MBXMLUtils::TiXmlElement *element); 00041 private: 00042 MBSim::Function1<fmatvec::Vec, double> * function; 00043 fmatvec::Vec y; 00044 }; 00045 00050 class Function1_SSEvaluation : public Signal { 00051 public: 00052 Function1_SSEvaluation(const std::string &name="") : Signal(name), signal(NULL), fun(NULL), signalString("") {} 00053 void initializeUsingXML(MBXMLUtils::TiXmlElement *element); 00054 void init(MBSim::InitStage stage); 00055 void setSignal(Signal * s) {signal=s; } 00056 void setFunction(MBSim::Function1<double, double>* fun_) {fun=fun_; } 00057 fmatvec::Vec getSignal(); 00058 private: 00059 Signal * signal; 00060 MBSim::Function1<double, double>* fun; 00061 std::string signalString; 00062 }; 00063 00068 class Function2_SSSEvaluation : public Signal { 00069 public: 00070 Function2_SSSEvaluation(const std::string &name="") : Signal(name), signal1(NULL), signal2(NULL), fun(NULL), signal1String(""), signal2String("") {} 00071 void initializeUsingXML(MBXMLUtils::TiXmlElement *element); 00072 void init(MBSim::InitStage stage); 00073 void setSignals(Signal * s1, Signal * s2) {signal1=s1; signal2=s2; } 00074 void setFunction(MBSim::Function2<double, double, double>* fun_) {fun=fun_; } 00075 fmatvec::Vec getSignal(); 00076 private: 00077 Signal * signal1; 00078 Signal * signal2; 00079 MBSim::Function2<double, double, double>* fun; 00080 std::string signal1String; 00081 std::string signal2String; 00082 }; 00083 00084 } 00085 00086 #endif /* _FUNCTION_SENSOR_H_ */ 00087
1.8.0