def __init__(self, A=None, pressure_drop=None, p1=None, p2=None, flow=None, fluid=None, Cq=None): self.A = None if Cq: self.Cq = Cq else: self.Cq = Q.Scalar(0.67) if fluid: self.fluid = fluid else: self.fluid = Oil() if A: self.A = A elif (pressure_drop is not None and flow is not None and A is None and p1 is None and p2 is None): self.A = Q.Area(flow.uval / self.Cq.uval / functions.sqrt( 2. / self.fluid.density.uval * abs(pressure_drop.uval))) elif A is None and p1 is not None and p2 is not None and flow is not None: pressure_drop = p1 - p2 self.A = Q.Area(flow.uval / self.Cq.uval / functions.sqrt( 2. / self.fluid.density.uval * abs(pressure_drop.uval)))
def KQxB1__Jelali_4_226(self, xV, pS, pT, pA0, pB0): """Flow Gain Jelali page 105 eq 4.226""" if xV >= ETQ.Scalar(0., '1'): return -self.Cv1 * functions.sqrt(pB0 - pT) else: return -self.Cv1 * functions.sqrt(pS - pB0)
def flow(self, p1=None, p2=None, pressure_drop=None): if (p1 is not None) and (p2 is not None) and (pressure_drop is None): pressure_drop = p1 - p2 return Q.Flowrate( np.sign(pressure_drop.value) * self.Cq * self.A * functions.sqrt(2. / self.fluid.density * abs( (pressure_drop).uval)))
def param_given_xvmax(self, xvmax): xvmax = Q.Distance(xvmax) A = Q.Area(self.Cv1 / (self.Cq * functions.sqrt(2. / self.fluid.density))) dv = Q.Distance(A / (ETQ.PI * xvmax)) xvunderlap = Q.Distance(xvmax * self.underlap1) return { 'xvmax': xvmax, 'xvunderlap': xvunderlap, 'spoolDiameter': dv, 'A': A, 'Cq': self.Cq, 'density': self.fluid.density }
def __init__(self, **vargsd): if len(vargsd) != 1: raise Exception("circle has one parameter: but not %s" % vargsd) key, value = vargsd.popitem() self._retQuantitiy = False if isinstance(value, ETQ.QuantityNumeric): value = value.uval self._retQuantitiy = True if key in ('radius', 'r'): self._radius = value elif key in ('diameter', 'd'): self._radius = value / 2.0 elif key in ('area', 'A'): self._radius = sqrt(value / ETQ.PI) elif key in ('perimeter', 'U'): self._radius = value / (2.0 * ETQ.PI) elif key in ('momentOfAreaSecond', 'I'): self._radius = (value * 4. / ETQ.PI)**(1, 4) else: raise Exception("parameter not known: %s" % vargsd)
def omegah__Jelali_4_247(self, xP, mass): return ETQ.VelocityAngular(functions.sqrt(self.cylinder.areaP**2 / mass * ( self.fluid.bulkmodulus / self.cylinder.volume_A(xP) + self.cylinder.areaRatio**2 * self.fluid.bulkmodulus / self.cylinder.volume_B(xP) )))
def naturalFrequency(self, position, mass): mass = Q.Mass(mass) position = self.validPosition(position) kh = self.stiffness(position) return Q.Frequency(functions.sqrt(kh / mass) * 1. / (2. * Q.PI))
def slendernessRatio(self): I = self.momentOfArea2nd_effective A = self.beamSection.A rg = ETQ.Distance(ETTT.sqrt(I / A)) return ETQ.Scalar(self.lengthEffective / rg)
def slendernessRatio_limitEuler(self): return ETQ.Scalar( np.pi * ETTT.sqrt(self.material.youngs_modulus / self.material.Rp()))
def KQxB1_dp(self, dp): """Jelali page 105 eq 4.226, simplified""" return -self.Cv1 * functions.sqrt(dp)
def Cv1(self): """Cv for control signal -1..1""" return self.flowrate_nominal / ( functions.sqrt(self.pressuredrop_tot_nominal / 2) * (Q.Scalar(1.0, '1') + self.underlap1))
def KQpB1__Jelali_4_228(self, xV, xV0, pS, pT, pA0, pB0): if xV >= ETQ.Scalar(0., '1'): return -self.Cv1 * xV0 / (2. * functions.sqrt(pB0 - pT)) else: return self.Cv1 * xV0 / (2. * functions.sqrt(pS - pB0))
def KQpL1__Jelali_4_233(self, xV0, xV, pS, pT, pL0): """Jelali page 106 eq 4.233 TODO: whats about the ..0 ? """ return -signTrue(xV) * self.Cv1 * xV0 / ( np.sqrt(2.) * functions.sqrt(pS - pT - pL0 * np.sign(xV)))
def KQxL1__Jelali_4_232(self, xV, pS, pT, pL): """Jelali page 106 eq 4.232""" return self.Cv1 * np.sqrt(2.) * functions.sqrt(pS - pT - pL * signTrue(xV))