mbsimhydraulics  3.2.0
rigid_line.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  _RIGID_LINE_H_
00021 #define  _RIGID_LINE_H_
00022 
00023 #include "mbsimHydraulics/hline.h"
00024 
00025 namespace MBSimControl {
00026   class Signal;
00027 }
00028 
00029 namespace MBSimHydraulics {
00030 
00031   class LinePressureLoss;
00032 
00034   class RigidLine : public RigidHLine {
00035     public:
00036       RigidLine(const std::string &name="") : RigidHLine(name), diameter(0), pL(NULL), ReynoldsFactor(0) {}
00037       virtual std::string getType() const { return "RigidLine"; }
00038 
00039       void setDiameter(double diameter_) {diameter=diameter_; }
00040       double getDiameter() const {return diameter; }
00041       void setLinePressureLoss(LinePressureLoss * pL_) {pL=pL_; }
00042 
00043       void init(MBSim::InitStage stage);
00044 
00045       void plot(double t, double dt);
00046 
00047       void initializeUsingXML(MBXMLUtils::TiXmlElement *element);
00048     private:
00049       double diameter;
00050       LinePressureLoss * pL;
00051       double ReynoldsFactor;
00052   };
00053 
00054 
00055   class ClosablePressureLoss;
00056 
00058   class ClosableRigidLine : public RigidLine {
00059     public:
00060       ClosableRigidLine(const std::string &name="") : RigidLine(name), cpL(NULL), cpLSignal(NULL), cpLMinValue(0), cpLBilateral(false), refSignalString("") {}
00061       virtual std::string getType() const { return "ClosableRigidLine"; }
00062 
00063       void setClosablePressureLoss(ClosablePressureLoss * cpL_) {cpL=cpL_; }
00064       ClosablePressureLoss * getClosablePressureLoss() const {return cpL; }
00065       void setSignal(MBSimControl::Signal * s) {cpLSignal = s; }
00066       MBSimControl::Signal * getSignal() const {return cpLSignal; }
00067       void setMinimalValue(double v) {cpLMinValue=v; }
00068       double getMinimalValue() const {return cpLMinValue; }
00069       void setBilateral(bool b=true) {cpLBilateral=b; }
00070       bool isClosed() const;
00071       double getRegularizedValue() const;
00072 
00073       void init(MBSim::InitStage stage);
00074 
00075       void initializeUsingXML(MBXMLUtils::TiXmlElement *element);
00076     private:
00077       ClosablePressureLoss * cpL;
00078       MBSimControl::Signal * cpLSignal;
00079       double cpLMinValue;
00080       bool cpLBilateral;
00081       std::string refSignalString;
00082   };
00083 
00084 
00085   class UnidirectionalPressureLoss;
00086 
00088   class UnidirectionalRigidLine : public RigidLine {
00089     public:
00090       UnidirectionalRigidLine(const std::string &name="") : RigidLine(name), upL(NULL), dpMin(0) {}
00091       virtual std::string getType() const { return "UnidirectionalRigidLine"; }
00092 
00093       void setUnidirectionalPressureLoss(UnidirectionalPressureLoss * upL_) {upL=upL_; }
00094       UnidirectionalPressureLoss * getUnidirectionalPressureLoss() const {return upL; }
00095       void setMinimalPressureDrop(double v) {dpMin=v; }
00096       double getMinimalPressureDrop() const {return dpMin; }
00097 
00098       void init(MBSim::InitStage stage);
00099 
00100       void initializeUsingXML(MBXMLUtils::TiXmlElement *element);
00101     private:
00102       UnidirectionalPressureLoss * upL;
00103       double dpMin;
00104   };
00105 
00106 }
00107 
00108 #endif   /* ----- #ifndef _RIGID_LINE_H_  ----- */
00109