|
mbsimhydraulics
3.2.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 _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(MBXMLUtils::TiXmlElement *element); 00044 void init(MBSim::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 virtual std::string getType() const { return "Leakage0DOF"; } 00059 00060 void setGapLengthSignal(MBSimControl::Signal * s) {glSignal=s; } 00061 double getGapLength() const; 00062 void setSurface1VelocitySignal(MBSimControl::Signal * s) {s1vSignal=s; } 00063 double getSurface1Velocity() const; 00064 void setSurface2VelocitySignal(MBSimControl::Signal * s) {s2vSignal=s; } 00065 double getSurface2Velocity() const; 00066 00067 void init(MBSim::InitStage stage); 00068 00069 void updateStateDependentVariables(double t); 00070 00071 void initializeUsingXML(MBXMLUtils::TiXmlElement * element); 00072 protected: 00073 LeakagePressureLoss * lpl; 00074 private: 00075 MBSimControl::Signal *s1vSignal, *s2vSignal, *glSignal; 00076 std::string s1vPath, s2vPath, glPath; 00077 }; 00078 00079 class PlaneLeakage0DOF : public Leakage0DOF { 00080 public: 00081 PlaneLeakage0DOF(const std::string &name="") : Leakage0DOF(name), hGap(0), wGap(0) {} 00082 virtual std::string getType() const { return "PlaneLeakage0DOF"; } 00083 00084 void setGapWidth(double wGap_) {wGap=wGap_; } 00085 double getGapWidth() const {return wGap; } 00086 void setGapHeight(double hGap_) {hGap=hGap_; } 00087 double getGapHeight() const {return hGap; } 00088 void setPlaneLeakagePressureLoss(PlaneLeakagePressureLoss * plpl); 00089 00090 void initializeUsingXML(MBXMLUtils::TiXmlElement * element); 00091 private: 00092 double hGap, wGap; 00093 }; 00094 00095 class CircularLeakage0DOF : public Leakage0DOF { 00096 public: 00097 CircularLeakage0DOF(const std::string &name="") : Leakage0DOF(name), rI(0), rO(0), hGap(0) {} 00098 virtual std::string getType() const { return "CircularLeakage0DOF"; } 00099 00100 void setInnerRadius(double rI_) {rI=rI_; } 00101 double getInnerRadius() const {return rI; } 00102 void setGapHeight(double hGap_) {hGap=hGap_; } 00103 double getGapHeight() const {return hGap; } 00104 double getOuterRadius() const {return rO; } 00105 void setCircularLeakagePressureLoss(CircularLeakagePressureLoss * clpl); 00106 00107 void init(MBSim::InitStage stage); 00108 00109 void initializeUsingXML(MBXMLUtils::TiXmlElement * element); 00110 private: 00111 double rI, rO, hGap; 00112 }; 00113 00114 } 00115 00116 #endif /* ----- #ifndef _DIMENSIONLESS_LINE_H_ ----- */ 00117
1.8.0