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