コード例 #1
0
    def _damped_response(self, non_linear_damping=0.0):
        SA0, SD0 = self.undamped_response  # retrieve undamped response
        assert len(SA0.shape) == 3
        initial_damping = self.initial_damping  # get initial damping
        damping_factor = non_linear_damping + initial_damping
        # get the reduction factors:
        Ra, Rv, Rd = calculate_reduction_factors(damping_factor)

        # maybe treat displacement sensitive as velocity sensitive:
        if self.csm_damping_regimes == CSM_DAMPING_REGIMES_USE_ALL:
            pass
        elif self.csm_damping_regimes == CSM_DAMPING_REGIMES_USE_RA_RV:
            Rd = Rv
        elif self.csm_damping_regimes == CSM_DAMPING_REGIMES_USE_RV:
            Ra = Rv
            Rd = Rv
        else:
            raise ValueError

        TAV, TVD = self.corner_periods  # get corner periods
        assert len(TAV.shape) == 2
        assert len(TVD.shape) == 2
        # damp the corner periods is flag is set:
        # (note this does not affect the original corner periods)
        assert Ra.shape[-1] == 1
        assert Rv.shape[-1] == 1
        assert len(Ra.shape) == 3
        assert len(Rv.shape) == 3
        if self.csm_damping_modify_Tav == CSM_DAMPING_MODIFY_TAV:
            # print 'damping',damping_factor
            # print 'TAV',TAV[:,0:5]
            # print 'Ra,Rv',Ra[:,0:5],Rv[:,0:5]
            TAV = TAV * (Ra[..., 0] / Rv[..., 0])
            # print 'TAV',TAV[:,0:5]

        periods = self.periods

        # update SA:
        SA, SD = calculate_updated_demand(
            periods,
            SA0,
            SD0,
            Ra,
            Rv,
            Rd,
            TAV,
            TVD,
            csm_damping_use_smoothing=self.csm_damping_use_smoothing)
        # update capacity:
        SAcap = calculate_capacity(SD, self.capacity_parameters)
        return SA, SD, SAcap
コード例 #2
0
    def _damped_response(self, non_linear_damping=0.0):
        SA0, SD0 = self.undamped_response  # retrieve undamped response
        assert len(SA0.shape) == 3
        initial_damping = self.initial_damping  # get initial damping
        damping_factor = non_linear_damping + initial_damping
        # get the reduction factors:
        Ra, Rv, Rd = calculate_reduction_factors(damping_factor)

        # maybe treat displacement sensitive as velocity sensitive:
        if self.csm_damping_regimes == CSM_DAMPING_REGIMES_USE_ALL:
            pass
        elif self.csm_damping_regimes == CSM_DAMPING_REGIMES_USE_RA_RV:
            Rd = Rv
        elif self.csm_damping_regimes == CSM_DAMPING_REGIMES_USE_RV:
            Ra = Rv
            Rd = Rv
        else:
            raise ValueError

        TAV, TVD = self.corner_periods  # get corner periods
        assert len(TAV.shape) == 2
        assert len(TVD.shape) == 2
        # damp the corner periods is flag is set:
        # (note this does not affect the original corner periods)
        assert Ra.shape[-1] == 1
        assert Rv.shape[-1] == 1
        assert len(Ra.shape) == 3
        assert len(Rv.shape) == 3
        if self.csm_damping_modify_Tav == CSM_DAMPING_MODIFY_TAV:
            # print 'damping',damping_factor
            # print 'TAV',TAV[:,0:5]
            # print 'Ra,Rv',Ra[:,0:5],Rv[:,0:5]
            TAV = TAV * (Ra[..., 0] / Rv[..., 0])
            # print 'TAV',TAV[:,0:5]

        periods = self.periods

        # update SA:
        SA, SD = calculate_updated_demand(
            periods, SA0, SD0, Ra, Rv, Rd, TAV, TVD,
            csm_damping_use_smoothing=self.csm_damping_use_smoothing)
        # update capacity:
        SAcap = calculate_capacity(SD, self.capacity_parameters)
        return SA, SD, SAcap
コード例 #3
0
    def test_update_demand_again(self):
        SA = array([0.342010, 0.763370, 0.653840, 0.530630, 0.44294,
                    0.38397, 0.34452, 0.321240, 0.302940, 0.276640,
                    0.248310, 0.15958, 0.11005, 0.080179, 0.055094,
                    0.039724, 0.029105, 0.021409, 0.015748])
        SA.shape = (1, 1, -1)
        SD = array([0, 1.895, 6.4923, 11.855, 17.593, 23.829,
                    30.789, 39.074, 48.129, 55.625, 61.64,
                    89.128, 109.27, 124.4, 123.09, 120.8,
                    115.6, 107.62, 97.732])
        SD.shape = (1, 1, -1)
        TAV = array([[0.46795]])
        TVD = array([[12.589]])

        damping_factor = [[[0.08+0.000540396780259699]]]
        periods = array([0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1,
                         1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5])
        damp_corner_periods = True

        # calc
        (Ra, Rv, Rd) = calculate_reduction_factors(damping_factor)
        if damp_corner_periods:
            TAV = (TAV*(Ra/Rv))[:,:,0]

        (SAnew, SDnew) = calculate_updated_demand(periods, SA, SD,
                                                  Ra, Rv, Rd, TAV, TVD)

        SA_new_m = array([0.289001251823406, 0.645044680932497,
                          0.552493097099059, 0.448383584870071,
                          0.378214709055794, 0.334886136749447,
                          0.303739197972188, 0.283211327986589,
                          0.267078826474521, 0.243891573578266,
                          0.21891385215188, 0.140684880819053,
                          0.0970201359460657, 0.0706874801683211,
                          0.0485714053533709, 0.0350210210488472,
                          0.0256594254042202, 0.0188746569449423,
                          0.0138838913645612])

        assert allclose(SAnew, SA_new_m, rtol=5e-5)
コード例 #4
0
    def test_update_demand_again(self):
        SA = array([0.342010, 0.763370, 0.653840, 0.530630, 0.44294,
                    0.38397, 0.34452, 0.321240, 0.302940, 0.276640,
                    0.248310, 0.15958, 0.11005, 0.080179, 0.055094,
                    0.039724, 0.029105, 0.021409, 0.015748])
        SA.shape = (1, 1, -1)
        SD = array([0, 1.895, 6.4923, 11.855, 17.593, 23.829,
                    30.789, 39.074, 48.129, 55.625, 61.64,
                    89.128, 109.27, 124.4, 123.09, 120.8,
                    115.6, 107.62, 97.732])
        SD.shape = (1, 1, -1)
        TAV = array([[0.46795]])
        TVD = array([[12.589]])

        damping_factor = [[[0.08+0.000540396780259699]]]
        periods = array([0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1,
                         1.5, 2, 2.5, 3, 3.5, 4, 4.5, 5])
        damp_corner_periods = True

        # calc
        (Ra, Rv, Rd) = calculate_reduction_factors(damping_factor)
        if damp_corner_periods:
            TAV = (TAV*(Ra/Rv))[:,:,0]

        (SAnew, SDnew) = calculate_updated_demand(periods, SA, SD,
                                                  Ra, Rv, Rd, TAV, TVD)

        SA_new_m = array([0.289001251823406, 0.645044680932497,
                          0.552493097099059, 0.448383584870071,
                          0.378214709055794, 0.334886136749447,
                          0.303739197972188, 0.283211327986589,
                          0.267078826474521, 0.243891573578266,
                          0.21891385215188, 0.140684880819053,
                          0.0970201359460657, 0.0706874801683211,
                          0.0485714053533709, 0.0350210210488472,
                          0.0256594254042202, 0.0188746569449423,
                          0.0138838913645612])

        assert allclose(SAnew, SA_new_m, rtol=5e-5)