mbsimhydraulics 4.0.0 MBSim Hydraulics Module

environment.h
1 /* Copyright (C) 2004-2009 MBSim Development Team
2 *
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 *
17 * Contact: markus.ms.schneider@gmail.com
18 */
19
20 #ifndef _MBSIMHYDRAULICS_ENVIRONMENT_H_
21 #define _MBSIMHYDRAULICS_ENVIRONMENT_H_
22
23 #include "mbxmlutilshelper/dom.h"
24 #include "mbsim/environment.h"
25
26 namespace MBSimHydraulics {
27
28 const MBXMLUtils::NamespaceURI MBSIMHYDRAULICS("http://www.mbsim-env.de/MBSimHydraulics");
29
31 class HydraulicEnvironment : public MBSim::Environment {
32 private:
33 double rhoConstant{0}, dVdT{0}, rho0{0}, T0{0}, dRhodT{0};
34 double (HydraulicEnvironment::*calcRho)(double T);
35 double calcConstantSpecificMass(double T) {return rhoConstant; }
36 double calcVolumeDependingOnTemperature(double T) {return rho0*(1./(1.+dVdT*(T-T0))); }
37 double calcSpecificMassDependingOnTemperature(double T) {return rho0 + dRhodT*(T- T0 ); }
38
39 double nuConstant{0}, Tm{0}, Wm{0}, T2{0}, m{0};
40 double (HydraulicEnvironment::*calcNu)(double T);
41 double calcConstantKinematicViscosity(double T) {return nuConstant; }
42 double calcWalterUbbelohdeKinematicViscosity(double T);
43
44 double T{0};
45
46 protected:
47 double E0{0}, kappa{0}, rho{0}, nu{0};
48 double pinf{0};
49
50 public:
51 HydraulicEnvironment() : Environment() {}
52 void initializeUsingXML(xercesc::DOMElement *e) override;
53 virtual void initializeFluidData();
54
56 void setBasicBulkModulus(double E0_) {E0=E0_; }
58 void setKappa(double kappa_) {kappa=kappa_; }
59
61 void setTemperature(double T_) {T=T_; }
62
64 void setConstantSpecificMass(double rho_);
66 void setVolumeDependingOnTemperature(double dVdT_, double rho0_, double T0_);
68 void setSpecificMassDependingOnTemperature(double dRhodT_, double rho0_, double T0_);
69
71 void setConstantKinematicViscosity(double nu_);
73 void setWalterUbbelohdeKinematicViscosity(double T1, double nu1, double T2, double nu2);
74
76 void setEnvironmentPressure(double pinf_) {pinf=pinf_; }
78 double getEnvironmentPressure() {return pinf; }
79
81 double getSpecificMass() {return rho; }
83 double getBasicBulkModulus() {return E0; }
85 double getKinematicViscosity() {return nu; }
87 double getKappa() {return kappa; }
89 double getDynamicViscosity() {return nu*rho; }
91 double getTemperature() {return T;}
92 };
93
95 class OilBulkModulus : public virtual fmatvec::Atom {
96 public:
97 OilBulkModulus(const std::string &name, double E0, double pinf, double kappa, double fracAir) {
98 ownerName=name;
99 factor[0]=E0*(1.+fracAir);
100 factor[1]=pow(pinf, 1./kappa) * fracAir * E0 / kappa;
101 factor[2]=-(1.+1./kappa);
102
103 // HYSIM[0]=E0;
104 // HYSIM[1]=fracAir*pinf;
105 // HYSIM[2]=pow(pinf, 1./kappa) * fracAir * E0 / kappa;
106 // HYSIM[3]=1./kappa;
107 }
108 double operator()(const double &p);
109 private:
110 std::string ownerName;
111 double factor[3];
112 double HYSIM[4];
113 };
114
115 }
116
117 #endif
MBSimHydraulics::HydraulicEnvironment::getDynamicViscosity
double getDynamicViscosity()
Definition: environment.h:89
MBSimHydraulics::HydraulicEnvironment::getTemperature
double getTemperature()
Definition: environment.h:91
MBSimHydraulics::HydraulicEnvironment::getSpecificMass
double getSpecificMass()
Definition: environment.h:81
MBSimHydraulics::HydraulicEnvironment::setSpecificMassDependingOnTemperature
void setSpecificMassDependingOnTemperature(double dRhodT_, double rho0_, double T0_)
Definition: environment.cc:106
MBXMLUtils::NamespaceURI
MBSimHydraulics::HydraulicEnvironment::setEnvironmentPressure
void setEnvironmentPressure(double pinf_)
Definition: environment.h:76
MBSim::Environment
MBSimHydraulics::HydraulicEnvironment::getKinematicViscosity
double getKinematicViscosity()
Definition: environment.h:85
MBSimHydraulics::OilBulkModulus
Definition: environment.h:95
MBSimHydraulics::HydraulicEnvironment::setConstantKinematicViscosity
void setConstantKinematicViscosity(double nu_)
Definition: environment.cc:113
MBSim::Environment::Environment
Environment()
MBSimHydraulics::HydraulicEnvironment::getEnvironmentPressure
double getEnvironmentPressure()
Definition: environment.h:78
MBSimHydraulics::HydraulicEnvironment::setKappa
void setKappa(double kappa_)
Definition: environment.h:58
MBSimHydraulics::HydraulicEnvironment::getKappa
double getKappa()
Definition: environment.h:87
MBSimHydraulics::HydraulicEnvironment::setTemperature
void setTemperature(double T_)
Definition: environment.h:61
MBSimHydraulics::HydraulicEnvironment::setWalterUbbelohdeKinematicViscosity
void setWalterUbbelohdeKinematicViscosity(double T1, double nu1, double T2, double nu2)
Definition: environment.cc:118
MBSimHydraulics::HydraulicEnvironment::setBasicBulkModulus
void setBasicBulkModulus(double E0_)
Definition: environment.h:56
MBSimHydraulics::HydraulicEnvironment::setVolumeDependingOnTemperature
void setVolumeDependingOnTemperature(double dVdT_, double rho0_, double T0_)
Definition: environment.cc:99
MBSimHydraulics::HydraulicEnvironment
Definition: environment.h:31
MBSimHydraulics::HydraulicEnvironment::setConstantSpecificMass
void setConstantSpecificMass(double rho_)
Definition: environment.cc:94
MBSimHydraulics::HydraulicEnvironment::getBasicBulkModulus
double getBasicBulkModulus()
Definition: environment.h:83