コード例 #1
0
 def solve_x_Asp_known(α1, fc, b, h0, N, e, fy_, As_, as_):
     '''已知受压钢筋面积As_求x'''
     _a = α1 * fc * b / 2
     _b = -α1 * fc * b * h0
     _c = N * e - fy_ * As_ * (h0 - as_)
     d = _b**2 - 4 * _a * _c
     if d > 0:
         valids = []
         d = sqrt(d)
         x1 = (-_b + d) / 2 / _a
         if x1 > 0:
             valids.append(x1)
         x2 = (-_b - d) / 2 / _a
         if x2 > 0:
             valids.append(x2)
         n = len(valids)
         if n < 1:
             raise numeric.NumericError('No proper solution.')
         elif n == 1:
             return valids[0]
         else:
             return min(valids)
     else:
         raise numeric.NumericError('No solution.')
コード例 #2
0
 def solve_x_As_known(cls, N, e, α1, fc, b, x, h0, fy_, as_, Es, εcu, β1,
                      As):
     '''已知受拉钢筋面积As求x'''
     x0 = x
     x1 = cls.f_x_As_known(N, e, α1, fc, b, x0, h0, fy_, as_, Es, εcu, β1,
                           As)
     count = 0
     while abs(x1 - x0) > 1E-6 and count < 100:
         x0 = x1
         x1 = cls.f_x_As_known(N, e, α1, fc, b, x0, h0, fy_, as_, Es, εcu,
                               β1, As)
         count += 1
     if count > 99:
         raise numeric.NumericError('No real solution.')
     return x1
コード例 #3
0
ファイル: loads.py プロジェクト: warmwaver/calla
    def active_earth_pressure_live(cls, φ, α, B, γ, H, G, δ=None):
        δ = δ or φ / 2
        ω = α + δ + φ
        tmp = (1 / tan(φ) + tan(ω)) * (tan(ω) - tan(α))
        if tmp < 0:
            raise numeric.NumericError(
                '公式(4.2.3-7)tanθ=-tan(ω)+sqrt((1/tan(φ)+tan(ω))*(tan(ω)-tan(α)))\
计算时根号中出现负值,请检查角度输入是否合理')
        tanθ = -tan(ω) + sqrt(tmp)  # (4.2.3-7)
        l0 = H * (tan(α) + tanθ)
        h = G / B / l0 / γ  # (4.3.4-1)
        β = 0
        μ = cls.fμ(φ, α, β, δ)
        E = 1 / 2 * B * μ * γ * H * (H + 2 * h)  # (4.2.3-6)
        C = H / 3 * (H + 3 * h) / (H + 2 * h)
        return (l0, h, E, C)
コード例 #4
0
    def solve_M(cls, α1, fc, fy, r, rs, A, As, N):
        """
        求解alpha和M,已知N和As
        """
        def f(α, α1, fc, fy, r, rs, A, As, N):
            # 式(E.0.4-1)两边取等号求解α,由于方程非线性,构造牛顿迭代法表达式
            if α < 0.625:
                return (N + α1 * fc * A * sin(2 * pi * α) / 2 / pi +
                        1.25 * fy * As) / (α1 * fc * A + 3 * fy * As)
            return (N + α1 * fc * A * sin(2 * pi * α) / 2 / pi) / (
                α1 * fc * A + fy * As)

        # 牛顿迭代法
        α = None
        try:
            α = numeric.iteration_method_solve(f,
                                               0.2,
                                               α1=α1,
                                               fc=fc,
                                               fy=fy,
                                               r=r,
                                               rs=rs,
                                               A=A,
                                               As=As,
                                               N=N)
        except:
            try:
                α = numeric.iteration_method_solve(f,
                                                   0.65,
                                                   α1=α1,
                                                   fc=fc,
                                                   fy=fy,
                                                   r=r,
                                                   rs=rs,
                                                   A=A,
                                                   As=As,
                                                   N=N)
            except:
                pass
        if α != None:
            Mu = cls.f_M(α, α1, fc, fy, r, rs, A, As)
            return (α, Mu)
        raise numeric.NumericError('No real solution')
コード例 #5
0
    def solve_As(α1, fc, fy, r, rs, A, N, M):
        """
        求解alpha和As,已知N和M
        """
        def _fMeq(α, α1, fc, fy, r, rs, A, N, M):
            # 由方程(E.0.4-1)得到As的表达式,代入(E.0.4-2),得到关于α的方程
            if α < 0.625:
                αt = 1.25 - 2 * α
            else:
                αt = 0
            C1 = 2 / 3 * sin(pi * α)**3 / pi
            C2 = (sin(pi * α) + sin(pi * αt)) / pi
            fyAs = (N - α1 * fc * A *
                    (α - sin(2 * pi * α) / 2 / pi)) / (α - αt)
            return α1 * fc * A * r * C1 + fyAs * rs * C2 - M

        # 以1.25/3为界查找有值区间
        x0 = 0
        x1 = 1.25 / 3 * 0.999
        f0 = _fMeq(x0, α1, fc, fy, r, rs, A, N, M)
        f1 = _fMeq(x1, α1, fc, fy, r, rs, A, N, M)
        if f0 * f1 > 0:
            x0 = 1.25 / 3 * 1.001
            x1 = 1
            f0 = _fMeq(x0, α1, fc, fy, r, rs, A, N, M)
            f1 = _fMeq(x1, α1, fc, fy, r, rs, A, N, M)
            if f0 * f1 > 0:
                raise numeric.NumericError('No real solution.')
        α = numeric.binary_search_solve(_fMeq,
                                        x0,
                                        x1,
                                        α1=α1,
                                        fc=fc,
                                        fy=fy,
                                        r=r,
                                        rs=rs,
                                        A=A,
                                        N=N,
                                        M=M)
        As = fc_round.f_As(α, α1, fc, fy, A, N)
        return (α, As)
コード例 #6
0
    def solve_As(cls, α1, fc, fy, r1, r2, rs, A, N, M):
        """
        求解α和As,已知N和M
        """
        def _fMeq(α, α1, fc, fy, r1, r2, rs, A, N, M):
            # 由方程(E.0.3-1)得到As的表达式,代入(E.0.3-2),得到关于α的方程
            if α < 0.625:
                αt = 1.25 - 2 * α
            else:
                αt = 0
            fyAs = (N - α * α1 * fc * A) / (α - αt)
            return α1 * fc * A * (r1 + r2) * sin(
                pi * α) / 2 / pi + fyAs * rs * (
                    (sin(pi * α) + sin(pi * αt)) / pi) - M

        # 以1.25/3为界查找有值区间
        x0 = 0
        x1 = 1.25 / 3 * 0.999
        f0 = _fMeq(x0, α1, fc, fy, r1, r2, rs, A, N, M)
        f1 = _fMeq(x1, α1, fc, fy, r1, r2, rs, A, N, M)
        if f0 * f1 > 0:
            x0 = 1.25 / 3 * 1.001
            x1 = 1
            f0 = _fMeq(x0, α1, fc, fy, r1, r2, rs, A, N, M)
            f1 = _fMeq(x1, α1, fc, fy, r1, r2, rs, A, N, M)
            if f0 * f1 > 0:
                raise numeric.NumericError('No real solution.')
        α = numeric.binary_search_solve(_fMeq,
                                        x0,
                                        x1,
                                        α1=α1,
                                        fc=fc,
                                        fy=fy,
                                        r1=r1,
                                        r2=r2,
                                        rs=rs,
                                        A=A,
                                        N=N,
                                        M=M)
        As = cls.f_As(α, α1, fc, fy, A, N)
        return (α, As)