Exemple #1
0
def test_lsfd():
    f, frf, modal_sim, eta_sim, f0_sim = get_simulated_receptance(
        df_Hz=1,
        f_start=0,
        f_end=5001,
        measured_points=8,
        show=False,
        real_mode=False)

    low_lim = 1500
    nf = (2 * (len(f) - 1))

    while max(prime_factors(nf)) > 5:
        f = f[:-1]
        frf = frf[:, :-1]
        nf = (2 * (len(f) - 1))

    df = (f[1] - f[0])
    nf = 2 * (len(f) - 1)
    ts = 1 / (nf * df)  # sampling period

    sr = lscf(frf,
              low_lim,
              6,
              ts,
              weighing_type='Unity',
              reconstruction='LSFD')
    fr, xi = complex_freq_to_freq_and_damp(sr[-1])
    print('Eigenfrequencies\n', fr)
    print('Damping factors\n', xi)
Exemple #2
0
def test_lsce():
    from OpenModal.analysis.utility_functions import complex_freq_to_freq_and_damp

    """    Test of the Least-Squares Complex Exponential Method    """
    from OpenModal.analysis.get_simulated_sample import get_simulated_receptance
    import matplotlib.pyplot as plt
    
    f, frf, modal_sim, eta_sim, f0_sim = get_simulated_receptance(df_Hz=1,
            f_start=0, f_end=5001, measured_points=8, show=False, real_mode=False)

    low_lim = 100
    nf = (2*(len(f)-low_lim-1))

    while max(prime_factors(nf)) > 5:
        f = f[:-1]
        frf = frf[:, :-1]
        nf = (2*(len(f)-low_lim-1))


    df = (f[1] - f[0])
    nf = 2*(len(f)-low_lim-1)
    ts = 1 / (nf * df)  # sampling period

    n = 12
    low_lim = 100

    sr = lsce(frf, f[low_lim], low_lim, n, ts, additional_timepoints=0, reconstruction='LSFD')

    fr, xi = complex_freq_to_freq_and_damp(sr[-2])

    print("fr\n", fr)
    print("xi\n", xi)
Exemple #3
0
def test_lsfd():
    f, frf, modal_sim, eta_sim, f0_sim = get_simulated_receptance(
        df_Hz=1, f_start=0, f_end=5001, measured_points=8, show=False, real_mode=False)

    low_lim = 1500
    nf = (2*(len(f)-low_lim-1))

    while max(prime_factors(nf)) > 5:
        f = f[:-1]
        frf = frf[:, :-1]
        nf = (2*(len(f)-low_lim-1))

    df = (f[1] - f[0])
    nf = 2*(len(f)-1)
    ts = 1 / (nf * df)  # sampling period

    sr = lscf(frf, low_lim, 6, ts, weighing_type='Unity', reconstruction='LSFD')
    fr, xi = complex_freq_to_freq_and_damp(sr[-1])
    print('Eigenfrequencies\n', fr)
    print('Damping factors\n', xi)
Exemple #4
0
def test_lsce():
    from OpenModal.analysis.utility_functions import complex_freq_to_freq_and_damp
    """    Test of the Least-Squares Complex Exponential Method    """
    from OpenModal.analysis.get_simulated_sample import get_simulated_receptance
    import matplotlib.pyplot as plt

    f, frf, modal_sim, eta_sim, f0_sim = get_simulated_receptance(
        df_Hz=1,
        f_start=0,
        f_end=5001,
        measured_points=8,
        show=False,
        real_mode=False)

    low_lim = 100
    nf = (2 * (len(f) - low_lim - 1))

    while max(prime_factors(nf)) > 5:
        f = f[:-1]
        frf = frf[:, :-1]
        nf = (2 * (len(f) - low_lim - 1))

    df = (f[1] - f[0])
    nf = 2 * (len(f) - low_lim - 1)
    ts = 1 / (nf * df)  # sampling period

    n = 12
    low_lim = 100

    sr = lsce(frf,
              f[low_lim],
              low_lim,
              n,
              ts,
              additional_timepoints=0,
              reconstruction='LSFD')

    fr, xi = complex_freq_to_freq_and_damp(sr[-2])

    print("fr\n", fr)
    print("xi\n", xi)
Exemple #5
0
def stabilisation(sr, nmax, err_fn, err_xi):
    """
    A function that computes the stabilisation matrices needed for the
    stabilisation chart. The computation is focused on comparison of
    eigenfrequencies and damping ratios in the present step 
    (N-th model order) with the previous step ((N-1)-th model order). 
    
    :param sr: list of lists of complex natrual frequencies
    :param n: maximum number of degrees of freedom
    :param err_fn: relative error in frequency
    :param err_xi: relative error in damping

    :return fn_temp eigenfrequencies matrix
    :return xi_temp: updated damping matrix
    :return test_fn: updated eigenfrequencies stabilisation test matrix
    :return test_xi: updated damping stabilisation test matrix
    
    @author: Blaz Starc
    @contact: [email protected]
    """

    # TODO: check this later for optimisation # this doffers by LSCE and LSCF
    fn_temp = np.zeros((2*nmax, nmax), dtype = 'double')
    xi_temp = np.zeros((2*nmax, nmax), dtype = 'double')
    test_fn = np.zeros((2*nmax, nmax), dtype = 'int')
    test_xi = np.zeros((2*nmax, nmax), dtype = 'int')

    for nr, n in enumerate(range(nmax)):
        fn, xi = complex_freq_to_freq_and_damp(sr[nr])
        fn, xi = redundant_values(fn, xi, 1e-3) # elimination of conjugate values in
                                                # order to decrease computation time
        if n == 1:
            # first step
            fn_temp[0:len(fn), 0:1] = fn
            xi_temp[0:len(fn), 0:1] = xi

        else:
            # Matrix test is created for comparison between present(N-th) and
            # previous (N-1-th) data (eigenfrequencies). If the value equals:
            # --> 1, the data is within relative tolerance err_fn
            # --> 0, the data is outside the relative tolerance err_fn
            fn_test = np.zeros((len(fn), len(fn_temp[:, n - 1])), dtype ='int')
            for i in range(0, len(fn)):
                for j in range(0, len(fn_temp[0:2*(n), n-1])):
                    if fn_temp[j, n-2] ==  0:
                        fn_test[i,j] = 0
                    else:
                        if np.abs((fn[i] - fn_temp[j, n-2])/fn_temp[j, n-2]) < err_fn:
                            fn_test[i,j] = 1
                        else: fn_test[i,j] = 0

            for i in range(0, len(fn)):
                test_fn[i, n - 1] = np.sum(fn_test[i, :]) # all rows are summed together

            # The same procedure as for eigenfrequencies is applied for damping
            xi_test = np.zeros((len(xi), len(xi_temp[:, n - 1])), dtype ='int')
            for i in range(0, len(xi)):
                for j in range(0, len(xi_temp[0:2*(n), n-1])):
                    if xi_temp[j, n-2]==0:
                        xi_test[i,j] = 0
                    else:
                        if np.abs((xi[i] - xi_temp[j, n-2])/xi_temp[j, n-2]) < err_xi:
                            xi_test[i,j] = 1
                        else: xi_test[i,j] = 0
            for i in range(0, len(xi)):
                test_xi[i, n - 1] = np.sum(xi_test[i, :])

            # If the frequency/damping values corresponded to the previous iteration,
            # a mean of the two values is computed, otherwise the value stays the same
            for i in range(0, len(fn)):
                for j in range(0, len(fn_temp[0:2*(n), n-1])):
                    if fn_test[i,j] == 1:
                        fn_temp[i, n - 1] = (fn[i] + fn_temp[j, n - 2]) / 2
                    elif fn_test[i,j] == 0:
                        fn_temp[i, n - 1] = fn[i]
            for i in range(0, len(fn)):
                for j in range(0, len(fn_temp[0:2*(n), n-1])):
                    if xi_test[i,j] == 1:
                        xi_temp[i, n - 1] = (xi[i] + xi_temp[j, n - 2]) / 2
                    elif xi_test[i,j] == 0:
                        xi_temp[i, n - 1] = xi[i]

    return fn_temp, xi_temp, test_fn, test_xi
Exemple #6
0
def stabilisation(sr, nmax, err_fn, err_xi):
    """
    A function that computes the stabilisation matrices needed for the
    stabilisation chart. The computation is focused on comparison of
    eigenfrequencies and damping ratios in the present step 
    (N-th model order) with the previous step ((N-1)-th model order). 
    
    :param sr: list of lists of complex natrual frequencies
    :param n: maximum number of degrees of freedom
    :param err_fn: relative error in frequency
    :param err_xi: relative error in damping

    :return fn_temp eigenfrequencies matrix
    :return xi_temp: updated damping matrix
    :return test_fn: updated eigenfrequencies stabilisation test matrix
    :return test_xi: updated damping stabilisation test matrix
    
    @author: Blaz Starc
    @contact: [email protected]
    """

    # TODO: check this later for optimisation # this doffers by LSCE and LSCF
    fn_temp = np.zeros((2*nmax, nmax), dtype = 'double')
    xi_temp = np.zeros((2*nmax, nmax), dtype = 'double')
    test_fn = np.zeros((2*nmax, nmax), dtype = 'int')
    test_xi = np.zeros((2*nmax, nmax), dtype = 'int')

    for nr, n in enumerate(range(nmax)):
        fn, xi = complex_freq_to_freq_and_damp(sr[nr])
        fn, xi = redundant_values(fn, xi, 1e-3) # elimination of conjugate values in
                                                # order to decrease computation time
        if n == 1:
            # first step
            fn_temp[0:len(fn), 0:1] = fn
            xi_temp[0:len(fn), 0:1] = xi

        else:
            # Matrix test is created for comparison between present(N-th) and
            # previous (N-1-th) data (eigenfrequencies). If the value equals:
            # --> 1, the data is within relative tolerance err_fn
            # --> 0, the data is outside the relative tolerance err_fn
            fn_test = np.zeros((len(fn), len(fn_temp[:, n - 1])), dtype ='int')
            for i in range(0, len(fn)):
                for j in range(0, len(fn_temp[0:2*(n), n-1])):
                    if fn_temp[j, n-2] ==  0:
                        fn_test[i,j] = 0
                    else:
                        if np.abs((fn[i] - fn_temp[j, n-2])/fn_temp[j, n-2]) < err_fn:
                            fn_test[i,j] = 1
                        else: fn_test[i,j] = 0

            for i in range(0, len(fn)):
                test_fn[i, n - 1] = np.sum(fn_test[i, :]) # all rows are summed together

            # The same procedure as for eigenfrequencies is applied for damping
            xi_test = np.zeros((len(xi), len(xi_temp[:, n - 1])), dtype ='int')
            for i in range(0, len(xi)):
                for j in range(0, len(xi_temp[0:2*(n), n-1])):
                    if xi_temp[j, n-2]==0:
                        xi_test[i,j] = 0
                    else:
                        if np.abs((xi[i] - xi_temp[j, n-2])/xi_temp[j, n-2]) < err_xi:
                            xi_test[i,j] = 1
                        else: xi_test[i,j] = 0
            for i in range(0, len(xi)):
                test_xi[i, n - 1] = np.sum(xi_test[i, :])

            # If the frequency/damping values corresponded to the previous iteration,
            # a mean of the two values is computed, otherwise the value stays the same
            for i in range(0, len(fn)):
                for j in range(0, len(fn_temp[0:2*(n), n-1])):
                    if fn_test[i,j] == 1:
                        fn_temp[i, n - 1] = (fn[i] + fn_temp[j, n - 2]) / 2
                    elif fn_test[i,j] == 0:
                        fn_temp[i, n - 1] = fn[i]
            for i in range(0, len(fn)):
                for j in range(0, len(fn_temp[0:2*(n), n-1])):
                    if xi_test[i,j] == 1:
                        xi_temp[i, n - 1] = (xi[i] + xi_temp[j, n - 2]) / 2
                    elif xi_test[i,j] == 0:
                        xi_temp[i, n - 1] = xi[i]

    return fn_temp, xi_temp, test_fn, test_xi