mbsimhydraulics  4.0.0
dimensionless_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  _DIMENSIONLESS_LINE_H_
00021 #define  _DIMENSIONLESS_LINE_H_
00022 
00023 #include "mbsimHydraulics/hline.h"
00024 
00025 namespace MBSimHydraulics {
00026 
00028   class DimensionlessLine : public HLine {
00029     public:
00030       DimensionlessLine(const std::string &name) : HLine(name), Q(1), length(0) {}
00031       virtual std::string getType() const { return "DimensionlessLine"; }
00032       
00033       void setLength(double length_) {length=length_; }
00034       double getLength() const {return length; }
00035 
00036       virtual fmatvec::Vec getQIn() {return Q; }
00037       virtual fmatvec::Vec getQOut() {return -Q; }
00038       virtual fmatvec::Vec getInflowFactor() {return fmatvec::Vec(1, fmatvec::INIT, -1.); }
00039       virtual fmatvec::Vec getOutflowFactor() {return fmatvec::Vec(1, fmatvec::INIT, 1.); }
00040       void calcqSize() {qSize=0; }
00041       void calcuSize(int j) {uSize[j]=0; }
00042       
00043       void initializeUsingXML(xercesc::DOMElement *element);
00044       void init(InitStage stage);
00045       void plot(double t, double dt);
00046     protected:
00047       fmatvec::Vec Q;
00048       double length;
00049   };
00050   
00051   class LeakagePressureLoss;
00052   class PlaneLeakagePressureLoss;
00053   class CircularLeakagePressureLoss;
00054 
00055   class Leakage0DOF : public DimensionlessLine {
00056     public:
00057       Leakage0DOF(const std::string &name) : DimensionlessLine(name), lpl(NULL), s1vSignal(NULL), s2vSignal(NULL), glSignal(NULL), s1vPath(""), s2vPath(""), glPath("") {}
00058       ~Leakage0DOF();
00059       virtual std::string getType() const { return "Leakage0DOF"; }
00060 
00061       void setGapLengthSignal(MBSimControl::Signal * s) {glSignal=s; }
00062       double getGapLength() const;
00063       void setSurface1VelocitySignal(MBSimControl::Signal * s) {s1vSignal=s; }
00064       double getSurface1Velocity() const;
00065       void setSurface2VelocitySignal(MBSimControl::Signal * s) {s2vSignal=s; }
00066       double getSurface2Velocity() const;
00067 
00068       void init(InitStage stage);
00069 
00070       void updateStateDependentVariables(double t);
00071 
00072       void initializeUsingXML(xercesc::DOMElement * element);
00073     protected:
00074       LeakagePressureLoss * lpl;
00075     private:
00076       MBSimControl::Signal *s1vSignal, *s2vSignal, *glSignal;
00077       std::string s1vPath, s2vPath, glPath;
00078   };
00079 
00080   class PlaneLeakage0DOF : public Leakage0DOF {
00081     public:
00082       PlaneLeakage0DOF(const std::string &name="") : Leakage0DOF(name), hGap(0), wGap(0) {}
00083       virtual std::string getType() const { return "PlaneLeakage0DOF"; }
00084 
00085       void setGapWidth(double wGap_) {wGap=wGap_; }
00086       double getGapWidth() const {return wGap; }
00087       void setGapHeight(double hGap_) {hGap=hGap_; }
00088       double getGapHeight() const {return hGap; }
00089       void setPlaneLeakagePressureLoss(PlaneLeakagePressureLoss * plpl);
00090 
00091       void initializeUsingXML(xercesc::DOMElement * element);
00092     private:
00093       double hGap, wGap;
00094   };
00095 
00096   class CircularLeakage0DOF : public Leakage0DOF {
00097     public:
00098       CircularLeakage0DOF(const std::string &name="") : Leakage0DOF(name), rI(0), rO(0), hGap(0) {}
00099       virtual std::string getType() const { return "CircularLeakage0DOF"; }
00100 
00101       void setInnerRadius(double rI_) {rI=rI_; }
00102       double getInnerRadius() const {return rI; }
00103       void setGapHeight(double hGap_) {hGap=hGap_; }
00104       double getGapHeight() const {return hGap; }
00105       double getOuterRadius() const {return rO; }
00106       void setCircularLeakagePressureLoss(CircularLeakagePressureLoss * clpl);
00107 
00108       void init(InitStage stage);
00109 
00110       void initializeUsingXML(xercesc::DOMElement * element);
00111     private:
00112       double rI, rO, hGap;
00113   };
00114 
00115 }
00116 
00117 #endif   /* ----- #ifndef _DIMENSIONLESS_LINE_H_  ----- */
00118