mbsimhydraulics  3.2.0
hydraulic_sensor.h
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  _HYDRAULIC_SENSOR_H_
00021 #define  _HYDRAULIC_SENSOR_H_
00022 
00023 #include "mbsimControl/sensor.h"
00024 
00025 namespace MBSimHydraulics {
00026 
00027   class HNode;
00028   class HLine;
00029 
00030   class FlowSensor : public MBSimControl::Sensor {
00031     public:
00032       FlowSensor(const std::string &name="") : MBSimControl::Sensor(name), line(NULL), lineString("") {}
00033       std::string getType() const { return "FlowSensor"; }
00034       fmatvec::Vec getSignal();
00035       void initializeUsingXML(MBXMLUtils::TiXmlElement *element);
00036       void init(MBSim::InitStage stage);
00037       void setHLine(HLine * line_) {line=line_; }
00038     protected:
00039       HLine * line;
00040       std::string lineString;
00041   };
00042 
00043   class PressureSensor : public MBSimControl::Sensor {
00044     public:
00045       PressureSensor(const std::string &name="") : MBSimControl::Sensor(name), node(NULL), nodeString("") {}
00046       std::string getType() const { return "PressureSensor"; }
00047       fmatvec::Vec getSignal();
00048       void initializeUsingXML(MBXMLUtils::TiXmlElement *element);
00049       void init(MBSim::InitStage stage);
00050       void setHNode(HNode * node_) {node=node_; }
00051     protected:
00052       HNode * node;
00053       std::string nodeString;
00054   };
00055 
00056   class TemperatureSensor : public MBSimControl::Sensor {
00057     public:
00058       TemperatureSensor(const std::string &name="") : MBSimControl::Sensor(name), T(1) {}
00059       std::string getType() const { return "TemperatureSensor"; }
00060       fmatvec::Vec getSignal() {return T; }
00061       void init(MBSim::InitStage stage);
00062     private:
00063       fmatvec::Vec T;
00064   };
00065 
00066   class KinematicViscositySensor : public MBSimControl::Sensor {
00067     public:
00068       KinematicViscositySensor(const std::string &name="") : MBSimControl::Sensor(name), nu(1) {}
00069       std::string getType() const { return "KinematicViscositySensor"; }
00070       fmatvec::Vec getSignal() {return nu; }
00071       void init(MBSim::InitStage stage);
00072     private:
00073       fmatvec::Vec nu;
00074   };
00075 
00076 }
00077 
00078 #endif   /* ----- #ifndef _HYDRAULIC_SENSOR_H_  ----- */
00079